Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find and display today's date cel

I have a spreadsheet that is used for scheduling. Column A ha
consecutive dates in it. I want to write a mcro that will search thi
column for the current date, and then display the worksheet with tha
cell in the top left corner. I am pretty new to VBA, and am gettin
nowhere with this. DOes anyone have a macro that does this, o
something similar, that I could use or refer to?

thanks,

And

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Find and display today's date cel

Hi
try the following macro:
Sub goto_date()
Dim rng As Range
Dim ret_value

Set rng = ActiveSheet.Range("A1:A100")
ret_value = Application.Match(CDbl(Date), rng, 0)
If IsError(ret_value) Then
MsgBox "Current date not found"
Else
Application.Goto reference:=ActiveSheet.Cells(ret_value, 1),
scroll:=True
End If
End Sub


--
Regards
Frank Kabel
Frankfurt, Germany


I have a spreadsheet that is used for scheduling. Column A has
consecutive dates in it. I want to write a mcro that will search this
column for the current date, and then display the worksheet with that
cell in the top left corner. I am pretty new to VBA, and am getting
nowhere with this. DOes anyone have a macro that does this, or
something similar, that I could use or refer to?

thanks,

Andy


---
Message posted from http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Find and display today's date cel

Try this

Sub Find_Todays_Date()
Dim FindString As Date
Dim Rng As Range
FindString = Date Set Rng = Range("A:A").Find(What:=FindString, _
After:=Range("A" & Rows.Count), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then Application.Goto Rng, True
End Sub
--
Regards Ron de Bruin
http://www.rondebruin.nl


"awander " wrote in message ...
I have a spreadsheet that is used for scheduling. Column A has
consecutive dates in it. I want to write a mcro that will search this
column for the current date, and then display the worksheet with that
cell in the top left corner. I am pretty new to VBA, and am getting
nowhere with this. DOes anyone have a macro that does this, or
something similar, that I could use or refer to?

thanks,

Andy


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Find and display today's date cel

Oops Line wrap

This is the good one

Sub Find_Todays_Date()
Dim FindString As Date
Dim Rng As Range
FindString = Date
Set Rng = Range("A:A").Find(What:=FindString, _
After:=Range("A" & Rows.Count), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then Application.Goto Rng, True
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
Try this

Sub Find_Todays_Date()
Dim FindString As Date
Dim Rng As Range
FindString = Date Set Rng = Range("A:A").Find(What:=FindString, _
After:=Range("A" & Rows.Count), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then Application.Goto Rng, True
End Sub
--
Regards Ron de Bruin
http://www.rondebruin.nl


"awander " wrote in message ...
I have a spreadsheet that is used for scheduling. Column A has
consecutive dates in it. I want to write a mcro that will search this
column for the current date, and then display the worksheet with that
cell in the top left corner. I am pretty new to VBA, and am getting
nowhere with this. DOes anyone have a macro that does this, or
something similar, that I could use or refer to?

thanks,

Andy


---
Message posted from http://www.ExcelForum.com/





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
conditional formatting for cell date to equal today's date Sistereinstein Excel Worksheet Functions 2 September 10th 12 07:53 PM
date in Cell to change colors if the date is beyond today's date Pete Elbert Excel Discussion (Misc queries) 2 June 6th 09 06:31 AM
create button to find today's date in another tab kjedgar65 Excel Worksheet Functions 1 March 22nd 09 09:14 AM
Find date query and Display issue VBA Noob Excel Worksheet Functions 2 July 14th 06 11:23 PM
find cell with today's date James D Excel Discussion (Misc queries) 2 January 16th 06 09:59 PM


All times are GMT +1. The time now is 01:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"