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: 29
Default Date find Macro

I need a marco that when I click on the macro button it will jump to a
date in column A which is 7 days foward from the current date. This
is rather than scrolling all the way down the column to find the
current week. Someone did me one for the same task but then I was
using a row not a column.

thanks

Johnnyboy

Here is that macro (for row)

Macro1 Macro
' Macro recorded 08/08/2009 by john hayward
'
Sub Auto_open()
'Sub Auto_Open()
MsgBox "This action will put the date to 7 days before today's date"

Dim rngRow1 As Range
Dim rngToFind As Range
Dim dateToday As Date

'Edit Sheet1 to match your worksheet
Sheets("Planner").Select

With ActiveSheet
Set rngRow1 = .Rows(1)
End With

dateToday = Date - 7

With rngRow1
Set rngToFind = .Find(What:=dateToday, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
End With

If Not rngToFind Is Nothing Then
rngToFind.Select
ActiveWindow.ScrollRow = rngToFind.Row
ActiveWindow.ScrollColumn = rngToFind.Column
Else
MsgBox "Date " & dateToday & " not found. It might be the weekend.
Get a life !"
End If

End Sub
 
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 to find matching date and copy values to another sheet Tiger Excel Discussion (Misc queries) 3 August 13th 07 01:45 PM
macro to find date in the string nshanmugaraj[_8_] Excel Programming 3 March 4th 06 12:30 PM
Using variables to make a date and using find method to find that. KyWilde Excel Programming 2 April 21st 05 09:43 PM
macro to find date format in a cell and delete that entire row vikram Excel Programming 8 April 30th 04 06:00 PM
Problems with Find and Date Fields in Excel macro Nick Marshall Excel Programming 1 October 15th 03 05:01 PM


All times are GMT +1. The time now is 06:15 AM.

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"