Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Select cell = today()

Hi, I'd like to create a macro which selects the cell in a column which
is equal to Today() or the next date following.

I have set up a task list in Excel and Column C has a list of
historical and future dates. As I'm a novice, can anyone assist in
providing a macro to be this? I am playing around with the 'nextrow'
argument but not getting anywhere.

thanks

Nelson

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Select cell = today()

Maybe...

Option Explicit
Sub testme02()

Dim wks As Worksheet
Dim myCol As Range
Dim res As Variant
Dim FirstDate As Long

Set wks = ActiveSheet

Set myCol = wks.Range("C1").EntireColumn

FirstDate = CLng(Date)

res = Application.Match(FirstDate, myCol, 0)

If IsError(res) Then
res = Application.Match(FirstDate + 1, myCol, 0)
End If

If IsError(res) Then
MsgBox "Today and Tomorrow weren't found!"
Else
myCol.Cells(1)(res).Select
End If

End Sub




wrote:

Hi, I'd like to create a macro which selects the cell in a column which
is equal to Today() or the next date following.

I have set up a task list in Excel and Column C has a list of
historical and future dates. As I'm a novice, can anyone assist in
providing a macro to be this? I am playing around with the 'nextrow'
argument but not getting anywhere.

thanks

Nelson


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Select cell = today()

Dim rng as Range, res as Variant, res1 as Variant
set rng = Range(Cells(1,1),Cells(1,1).End(xldown))
res = application.Match(clng(date),rng,0)
res1 = application.Match(clng(date + 1),rng,0)
if not iserror(res) then
rng(res).Select
elseif not iserror(res1) then
rng(res1).Select
else
msgbox "Not found"
end if

--
Regards,
Tom Ogilvy

wrote in message
ps.com...
Hi, I'd like to create a macro which selects the cell in a column which
is equal to Today() or the next date following.

I have set up a task list in Excel and Column C has a list of
historical and future dates. As I'm a novice, can anyone assist in
providing a macro to be this? I am playing around with the 'nextrow'
argument but not getting anywhere.

thanks

Nelson



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
display date of today in cell X when number 0 in cell Y anneleen machiels Excel Worksheet Functions 2 June 3rd 11 12:43 AM
Populate Cell with another cell, but only if the date equals today GaryS Excel Worksheet Functions 4 May 1st 08 04:39 AM
IF TODAY equals date in cell A10, or if TODAY is beyond that date SoupNazi Excel Worksheet Functions 4 April 23rd 07 01:14 AM
Addition to Turn cell red if today is greater or equal to date in cell Rich New Users to Excel 2 December 9th 04 02:06 AM
Turn cell red if today is greater or equal to date in cell Rich New Users to Excel 2 December 7th 04 10:50 PM


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