![]() |
Go to a cell that contains the data entered in another cell
I need help!
I have a spreadsheet with a calendar for all dates in a year. Total four pages long. Now I am trying to create a Command button that will help me find todays date or the date that I enter in a cell that I want to go to, simply by entering date and clicking the command button. Or enter the date that I am looking for in a cell and hit enter. It will scroll upto that date in the spreasheet. Thanks |
Go to a cell that contains the data entered in another cell
Let's say that in A1 thru A365 we have 1/1/2008 thru 12/31/2008. In the
worksheet code area paste: Private Sub Worksheet_Change(ByVal Target As Range) Set r = Range("B1") If Intersect(Target, r) Is Nothing Then Exit Sub v = r.Value For i = 1 To 365 If Cells(i, 1) = v Then Cells(i, 1).Select Exit Sub End If Next End Sub Enter a date in cell B1 and you will scroll to that date in A1. -- Gary''s Student - gsnu2007d "QD" wrote: I need help! I have a spreadsheet with a calendar for all dates in a year. Total four pages long. Now I am trying to create a Command button that will help me find todays date or the date that I enter in a cell that I want to go to, simply by entering date and clicking the command button. Or enter the date that I am looking for in a cell and hit enter. It will scroll upto that date in the spreasheet. Thanks |
Go to a cell that contains the data entered in another cell
On 10 Feb, 06:37, Gary''s Student
wrote: Let's say that in A1 thru A365 we have 1/1/2008 thru 12/31/2008. *In the worksheet code area paste: Private Sub Worksheet_Change(ByVal Target As Range) Set r = Range("B1") If Intersect(Target, r) Is Nothing Then Exit Sub v = r.Value For i = 1 To 365 * * If Cells(i, 1) = v Then * * * * Cells(i, 1).Select * * * * Exit Sub * * End If Next End Sub Enter a date in cell B1 and you will scroll to that date in A1. -- Gary''s Student - gsnu2007d "QD" wrote: I need help! I have a spreadsheet with a calendar for all dates in a year. Total four pages long. Now I am trying to create a Command button that will help me find todays date or the date that I enter in a cell that I want to go to, simply by entering date *and clicking the command button. Or enter the date that I am looking for in a cell and hit enter. It will scroll upto that date in the spreasheet. Thanks- Hide quoted text - - Show quoted text - Gary's Student, You are a genious!! Thanks a bunch. This works great if the dates in one column. I have set it up as a calendar by month. What I need to do to get the code to work. January SUN MON TUE WED THU FRI SAT 01/01/2008 01/02/2008 01/03/2008 01/04/2008 01/04/2008 01/05/2008 and so on. Thanks a million!!! |
Go to a cell that contains the data entered in another cell
Gary,
Would it also be possible to get the target cell to scroll all the way to the top left corner of the screen, eg to "B2"'s position? Thanks |
All times are GMT +1. The time now is 02:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com