LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Want a Macro for Date


See if this works

Sub sortDate()
Dim FindDate As String

Set Sourcesht = Sheets("sheet1")
Set DestSht = Sheets("sheet2")

NewRow = 1

With Sourcesht
FindDate = .Range("A2") 'Format(.Range("A2"), "mm/dd/yy")
RowCount = 3
Do While .Range("A" & RowCount) < ""
'find the A2 data in current row
Set SearchRange = .Range("A" & RowCount & ":E" & RowCount)
Set c = SearchRange.Find(what:=FindDate, _
LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
'copy date to new sheet
Rows(RowCount).Copy _
Destination:=DestSht.Rows(NewRow)
With DestSht
Set SortRange = .Range("A" & NewRow & ":E" & NewRow)
SortRange.Sort _
Header:=xlNo, _
key1:=.Range("A" & NewRow), _
order1:=xlDescending, _
Orientation:=xlLeftToRight

NewRow = NewRow + 1
End With
End If

RowCount = RowCount + 1
Loop

End With




End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=157472

Microsoft Office Help

 
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
Macro Help + date Neil Holden Excel Programming 2 September 15th 09 04:24 PM
macro to date stamp to the right of the macro command button Roha Excel Programming 4 July 31st 09 01:26 PM
Macro to Insert Current Date into cell - Macro to "Save As" Guy[_2_] Excel Worksheet Functions 4 December 12th 08 08:20 PM
Date Macro if B is populated then date in A RefLib1978 Excel Programming 3 August 23rd 07 05:52 PM
A macro for the today's date...not the current date abxy[_18_] Excel Programming 7 February 8th 04 11:05 PM


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