LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default VBA - programming months

Hi Simon,

Seems your seq has problem. Try

For Each c In Range("E1:E20")
MyMonth = c.Offset(0, 1)
MyDate = Month(MyMonth)
...
Next

Best Regards

Bill

-----Original Message-----
Hi there,.

I now have something like this but it is not working
correctly. Any ideas?

In column E cells have the word network in them
In column F (c.Offset(0, 1)) there is various dates

I am trying to compare these dates in column F (months)

to
see if they are greater than April.

I need to use the offset function since the lines will
always change.

Here it is.

Dim MyDate, MyMonth
MyDate = Month(MyMonth)

For Each c In Range("E1:E20")
MyMonth = c.Offset(0, 1)

If c.Value = "network" Then
If MyDate Month(DateSerial(2003, 4, 1)) Then

c.Offset(0, -4) = "yes"

Else

c.Offset(0, -4) = "no"

End If
End If

Next
End Sub

Thanks again

Simon

.

 
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
3 months prior and 3 months post a date renee Excel Worksheet Functions 2 May 2nd 08 05:46 PM
Adding months to dates should account for 28-30-31 day months Graham Excel Worksheet Functions 3 February 1st 06 12:06 PM
converting months to years and months??? Marty Excel Discussion (Misc queries) 1 February 18th 05 02:38 AM
How do i change 15 months to read 1 year and 3 months? Marty Excel Discussion (Misc queries) 1 February 17th 05 11:21 PM
Dates to months and calculating values for their months jigsaw2 Excel Programming 1 September 5th 03 01:35 PM


All times are GMT +1. The time now is 05:49 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"