Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF sum is GreaterThan 0... why wont this work!? Tan. Excel Worksheet Functions 3 January 18th 06 09:36 PM


All times are GMT +1. The time now is 01:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"