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: 1,049
Default Check Date, Include dates from rest of month and all of next month

Sub tester()


Dim keydate As Date
Dim yr As Long
Dim target As Range
Dim bremove As Boolean

'initialise date
keydate = DateSerial(Year(Range("B1").Value), Month(Range("B1").Value), 1)


Set target = Range("B2")
Do Until target.Value = ""
bremove = True
'check this month
If DateSerial(Year(target.Value), Month(target.Value), 1) = keydate Then
bremove = False
'check next month
ElseIf DateSerial(Year(target.Value), Month(target.Value) - 1, 1) =
keydate Then
bremove = False
End If
If bremove Then
Rows(target.Row).Delete
End If

Set target = target.ffset(1)
Loop

End Sub




"MSchmidty2" wrote in message
...
Hi,
I'm working on a chart which has a variety of job numbers in column a.
These job #'s are coupled with dates in column b. I need to check the
date
of the top cell in the column, and then keep the dates from the rest of
the
month from that date, and also the next month, while deleting the rest of
the
job #'s and dates beyond that. I can't hide the rows because there is
more
information that is needed. Any tips would be appreciated. Thanks!


 
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
count month when date is in day/month/year format ccKennedy Excel Worksheet Functions 6 April 30th 09 03:32 AM
Dates - Need to display date one month prior to user-entered date brettopp Excel Worksheet Functions 13 December 3rd 07 05:58 PM
Date arithmetic: adding 1 month to prior end of month date manxman Excel Worksheet Functions 2 July 14th 06 09:29 PM
Sort month/date/year data using month and date only SMW820 Excel Discussion (Misc queries) 6 June 22nd 06 05:14 PM
Fill column with dates of month depending on month in A1 [email protected] Excel Programming 7 March 11th 05 12:41 AM


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