Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Find cell for today

I'm trying to code a button on my calendar spreadsheet to find the cell for
today. My dates are functions from one cell g10 = 1/1/2009, g11 = g10+1,g12
= g11+1... and so on. The value for my what part is =today(). I'm not sure
if it's the range values being functions or the value looking for being
=today() that is messing it up or something else. I just want to have the
button find the cell in that range that equals the date. Here's my code that
I was trying to use. Thanks.

Dim FindCell As Range
With ActiveSheet
Set FindCell = .Range("g11:g2000").Find(what:=.Range("n1"))
If FindCell Is Nothing Then
MsgBox "Not found"
Else
FindCell.Activate
End If
End With
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Find cell for today

Dim FindCell As Range
Dim mydate As Date
mydate = Date
With ActiveSheet
Set FindCell = .Range("g11:g2000").Find(what:=mydate)
If FindCell Is Nothing Then
MsgBox "Not found"
Else
FindCell.Activate
End If
End With


Gord Dibben MS Excel MVP

On Wed, 23 Sep 2009 12:36:02 -0700, Jake F
wrote:

I'm trying to code a button on my calendar spreadsheet to find the cell for
today. My dates are functions from one cell g10 = 1/1/2009, g11 = g10+1,g12
= g11+1... and so on. The value for my what part is =today(). I'm not sure
if it's the range values being functions or the value looking for being
=today() that is messing it up or something else. I just want to have the
button find the cell in that range that equals the date. Here's my code that
I was trying to use. Thanks.

Dim FindCell As Range
With ActiveSheet
Set FindCell = .Range("g11:g2000").Find(what:=.Range("n1"))
If FindCell Is Nothing Then
MsgBox "Not found"
Else
FindCell.Activate
End If
End With


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Find cell for today

Given the structure of your data, you should be able to use this single
statement to activate the cell you want...

Range("G" & (10 + Date - Range("G10").Value)).Select

--
Rick (MVP - Excel)


"Jake F" wrote in message
...
I'm trying to code a button on my calendar spreadsheet to find the cell
for
today. My dates are functions from one cell g10 = 1/1/2009, g11 =
g10+1,g12
= g11+1... and so on. The value for my what part is =today(). I'm not
sure
if it's the range values being functions or the value looking for being
=today() that is messing it up or something else. I just want to have the
button find the cell in that range that equals the date. Here's my code
that
I was trying to use. Thanks.

Dim FindCell As Range
With ActiveSheet
Set FindCell = .Range("g11:g2000").Find(what:=.Range("n1"))
If FindCell Is Nothing Then
MsgBox "Not found"
Else
FindCell.Activate
End If
End With


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Find cell for today

Actually, this is probably a better single line statement version than my
previous posting...

Range("G10").Offset(Date - Range("G10").Value).Select

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
Given the structure of your data, you should be able to use this single
statement to activate the cell you want...

Range("G" & (10 + Date - Range("G10").Value)).Select

--
Rick (MVP - Excel)


"Jake F" wrote in message
...
I'm trying to code a button on my calendar spreadsheet to find the cell
for
today. My dates are functions from one cell g10 = 1/1/2009, g11 =
g10+1,g12
= g11+1... and so on. The value for my what part is =today(). I'm not
sure
if it's the range values being functions or the value looking for being
=today() that is messing it up or something else. I just want to have
the
button find the cell in that range that equals the date. Here's my code
that
I was trying to use. Thanks.

Dim FindCell As Range
With ActiveSheet
Set FindCell = .Range("g11:g2000").Find(what:=.Range("n1"))
If FindCell Is Nothing Then
MsgBox "Not found"
Else
FindCell.Activate
End If
End With



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
Formula to find the date closest to today. jem264 Excel Discussion (Misc queries) 3 February 26th 10 06:27 PM
How can I find out what date going to be 3 month from today in ex Shahin Khan Excel Worksheet Functions 5 May 8th 08 05:36 PM
find measure prev. day qty vs bus. hrs today/8.. nastech Excel Discussion (Misc queries) 6 July 10th 07 12:00 AM
Use Vlookup to find less than today Bruce Excel Worksheet Functions 3 April 26th 06 10:05 PM
Find (Today-21) in a range of dates JG Excel Discussion (Misc queries) 4 March 15th 05 03:59 PM


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

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"