Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default If Then statement comparing date values



Sub ABC()
Dim fillamt as Long, r as Range
'fillamt = "13"
fillamt = UserForm1.TextBox6.Value
Set r = Range("A1").Resize(fillamt , 1)
Range("A1").AutoFill r
r.Copy r.Offset(0, 1)
r.NumberFormat = "m/d/yyyy"
r.Offset(0, 1).NumberFormat = "ddd"
For Each cell In r
If Weekday(cell, vbSunday) = 7 Then
cell.Offset(0, 3).Value = 0
End If
Next
End Sub


--
Regards,
Tom Ogilvy


"ll" wrote:

Hi,
I'm working on an If Then statement that compares date values. I've
currently got the following, but it isn't working. Thanks for any
help you might provide. - Louis
-------------------------------------
fillamt = UserForm1.TextBox6.Value
For j = 2 To fillamt

Cells(j, 1).Value = Cells(j - 1, 1).Value + 1
Cells(j, 1).NumberFormat = "m/d/yyyy"

Cells(j, 2).Value = Cells(j - 1, 2).Value + 1
Cells(j, 2).NumberFormat = "ddd"

If Cells(j, 2) = "Sat" Then
Cells(j, 4).Select
ActiveCell = "0"
End If

Next j


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
HELP! I need to make an IF Statement comparing date/time fields.. Ksoloway Excel Worksheet Functions 2 November 4th 09 04:41 PM
If statement comparing times GoBrowns! Excel Worksheet Functions 1 June 17th 09 02:33 PM
comparing text in if statement Dolemite[_3_] Excel Programming 1 August 19th 05 01:02 AM
Comparing values in two columns and displaying missing values in n cpetta Excel Programming 1 April 2nd 05 06:18 AM
Macro for comparing 2 values (number and date) marthab Excel Programming 2 August 19th 04 10:21 PM


All times are GMT +1. The time now is 02:03 PM.

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

About Us

"It's about Microsoft Excel"