Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
value lessthan x and greaterthan y
my excel file lists files in a certain folder (txt files to be imported
in columnA, lists the dates those files were modified in columnB, an columnC shows the dates in columnB in general form (ex. 37866). Column lists when certain reports should be run in general date format. i a trying to tell VB to make sure the date from columnC is between th values in two fields in columnF to know if the report should be run below is the code i have written, but excel still runs the report eve if i put in dates that not not make the IF statements true, thus shoul not run the reports. here is a snippet of the code : Sub Summer2() Sheets("Extra").Select If Range("F20") <= Range("C2") <= Range("F23") Then SummerPasteData SummerAdminReports End If Sheets("Extra").Select If Range("F21") <= Range("C2") <= Range("F22") Then SummerStudentReports End If End Sub any ideas? is this not how to tell VB to compare one value ot make sur it is greaterthan one and less than another? i could not find anythin in VB help or on this board that would show how to combine compariso operators such as the one above i am attempting. thanks in advance fo your help -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
value lessthan x and greaterthan y
Hi
change the line If Range("F20") <= Range("C2") <= Range("F23") Then to If Range("F20").value <= Range("C2").value and _ Range("C2").value <= Range("F23").value Then -- Regards Frank Kabel Frankfurt, Germany my excel file lists files in a certain folder (txt files to be imported) in columnA, lists the dates those files were modified in columnB, and columnC shows the dates in columnB in general form (ex. 37866). ColumnF lists when certain reports should be run in general date format. i am trying to tell VB to make sure the date from columnC is between the values in two fields in columnF to know if the report should be run. below is the code i have written, but excel still runs the report even if i put in dates that not not make the IF statements true, thus should not run the reports. here is a snippet of the code : Sub Summer2() Sheets("Extra").Select If Range("F20") <= Range("C2") <= Range("F23") Then SummerPasteData SummerAdminReports End If Sheets("Extra").Select If Range("F21") <= Range("C2") <= Range("F22") Then SummerStudentReports End If End Sub any ideas? is this not how to tell VB to compare one value ot make sure it is greaterthan one and less than another? i could not find anything in VB help or on this board that would show how to combine comparison operators such as the one above i am attempting. thanks in advance for your help! --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
value lessthan x and greaterthan y
Try this!
Sub Summer2() Sheets("Extra").Select If Range("F20") <= Range("C2") Then If Range("C2") <= Range("F23") Then SummerPasteData SummerAdminReports End If End If Sheets("Extra").Select If Range("F21") <= Range("C2") Then If Range("C2") <= Range("F22") Then SummerStudentReports End If End If End Su -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
value lessthan x and greaterthan y
thanks frank! man, i knew it had to be possible, but i couldn't find i
anywhere! i really appreciate all the help you give to this board, know personally your tips and help have helped me be able to create great excel project! Frank Kabel wrote: *Hi change the line If Range("F20") <= Range("C2") <= Range("F23") Then to If Range("F20").value <= Range("C2").value and _ Range("C2").value <= Range("F23").value Then -- Regards Frank Kabel Frankfurt, Germany -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF sum is GreaterThan 0... why wont this work!? | Excel Worksheet Functions |