Posts by paolenz

    I am having problem with this VBA. It won't paste to a merged cell. Can anyone try to solve this, please?





    Dave,


    I ran your program and it worked perfectly fine, even the saving of the csv file. However, when I substituted my own variables, I was getting a lot of errors. The ones I underlined were the ones that gave me the most trouble. I only have one column of 3K plus rows. Your VBA code is written cleanly. Thanks in advance and for making the time from your schedule to work on this little problem.


    Sub Something_Or_Other()
    Dim LstRw As Long, sh As Worksheet, ws As Worksheet, x

    Set ws = Sheets("Start")
    Application.DisplayAlerts = False
    For x = 1 To 10
    Set sh = Sheets.Add
    sh.Name = ???
    With ws
    ActiveSheet.Range("F2:F3000").Value = .Range("F2:F3000").Value
    .Range("F2:F3000").EntireRow.Delete shift:=xlUp

    Application.CutCopyMode = False
    End With
    Sheets(x).Copy
    ActiveWorkbook.SaveAs Filename:= _
    "C:\Users\bx8qd0\Downloads\TextCSV" & x & ".csv", FileFormat:=xlCSV, _
    CreateBackup:=False
    ActiveWorkbook.Close
    Next x


    End Sub

    [FONT="Helvetica"]I am very new to this site and to Excel as well. I have been trying to solve this problem and I could not get it done. The table below is represented by 3 tours as seen by the look up table below.
    Under the Tour heading, it should give me a result that indicates the time stamp belong to Tour 1, and then when the formula hits a different time stamp, it would then say Tour 2, etc...
    My problem is that if I used a nested if statement it will evaluate the condition and when the condition is true it would not evaluate the rest of the conditions. This is where I am having trouble trying to find a formula that can evaluate three conditions at the same time. "Note: I just typed the different tours manually and without using a formula". I just wanted to show how the results would look like if excel formula was written logically. [/FONT]
    [TABLE="border: 0, cellpadding: 0, cellspacing: 0, width: 395"]

    [tr]


    [td]

    Time Stamp

    [/td]


    [td]

    Tour

    [/td]


    [/tr]


    [tr]


    [td]

    05:46:03

    [/td]


    [td]

    Tour 1

    [/td]


    [/tr]


    [tr]


    [td]

    05:45:58

    [/td]


    [td]

    Tour 1

    [/td]


    [/tr]


    [tr]


    [td]

    06:22:34

    [/td]


    [td]

    Tour 1

    [/td]


    [/tr]


    [tr]


    [td]

    07:24:58

    [/td]


    [td]

    Tour 2

    [/td]


    [/tr]


    [tr]


    [td]

    07:25:03

    [/td]


    [td]

    Tour 2

    [/td]


    [/tr]


    [tr]


    [td]

    12:19:50

    [/td]


    [td]

    Tour 2

    [/td]


    [/tr]


    [tr]


    [td]

    19:35:21

    [/td]


    [td]

    Tour 3

    [/td]


    [/tr]


    [tr]


    [td]

    19:35:22

    [/td]


    [td]

    Tour 3

    [/td]


    [/tr]


    [tr]


    [td]

    23:34:01

    [/td]


    [td]

    Tour 1

    [/td]


    [/tr]


    [tr]


    [td]

    03:23:37

    [/td]


    [td]

    Tour 1

    [/td]


    [/tr]


    [tr]


    [td]

    03:48:24

    [/td]


    [td]

    Tour 1

    [/td]


    [/tr]


    [tr]


    [td]

    10:43:38

    [/td]


    [td]

    Tour 2

    [/td]


    [/tr]


    [tr]


    [td]

    09:51:34

    [/td]


    [td]

    Tour 2

    [/td]


    [/tr]


    [tr]


    [td]

    12:47:46

    [/td]


    [td]

    Tour 2

    [/td]


    [/tr]


    [tr]


    [td]

    20:03:39

    [/td]


    [td]

    Tour 3

    [/td]


    [/tr]


    [tr]


    [td]

    22:30:01

    [/td]


    [td]

    Tour 3

    [/td]


    [/tr]


    [/TABLE]





    [TABLE="border: 0, cellpadding: 0, cellspacing: 0, width: 376"]

    [tr]


    [TD="colspan: 3"]LOOK UP Table[/TD]

    [/tr]


    [tr]


    [td]

    Tour

    [/td]


    [td][/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    Tour 2

    [/td]


    [TD="align: right"]7:00:00[/TD]
    [TD="align: right"]14:59:59[/TD]

    [/tr]


    [tr]


    [td]

    Tour 3

    [/td]


    [TD="align: right"]15:00:00[/TD]
    [TD="align: right"]22:59:59[/TD]

    [/tr]


    [tr]


    [td]

    Tour 1

    [/td]


    [TD="align: right"]23:00:00[/TD]
    [TD="align: right"]6:59:59 [/TD]

    [/tr]


    [/TABLE]


    [FONT="Helvetica"]=IF(AND(G7=<$M$2,G7=<$L$2, "Tour 2", IF(AND(G7=>$L$3, G7=<$M$3, "Tour 3", IF(AND(G7>=$M$4, G7=<$L$4, "Tour 1"))))))


    Here is my attempt and it is not working at all. Can someone see the errors of my formula?[/FONT]