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

Want a macro to sort data from (Column B,C,D,E) with whatever date mentioned
in Cell A2.
Column B,C,D,E have different dates what I want is to sort those columns as
per the date mentioned in cell A2.
Suppose if in cell A2 the date is 11/26/2009 then it should sort the data
from the Column B,C,D,E with that particular date in a new sheet in that
workbook.
And would like to assign that particular macro to a button

--
vijay
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Want a Macro for Date


Can you post a few rows of sample data and indicate what ROW the data
start at? I assume the data starts after row 2 since the date you are
comparing with is in cell A2.


--
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Want a Macro for Date

My Data is some how like this Joel

A B C D
E
1
2 TODAY()
3 01/10/2009 15/10/2009 25/10/2009 02/12/2009
4 05/10/2009 17/10/2009 30/11/2009 12/11/2009
5 30/11/2009 02/12/2009 03/11/2009 30/11/2009
6 1/12/2009 23/10/2009 07/11/2009 01/12/2009

Now what I want is whenever there is today date in cell A2 it should sort
that for the column B,C,D & E for that particular data and given me that sort
data on a new sheet (In this case Column E has the today date that is
30/11/2009).
As the data is huge and has different dates in each column, also were in i
need to keep a track on it date wise. So can you provide me with a macro
coding.
Thanks

--
vijay


"joel" wrote:


Can you post a few rows of sample data and indicate what ROW the data
start at? I assume the data starts after row 2 since the date you are
comparing with is in cell A2.


--
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

.

  #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

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
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 09:35 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"