Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello!
I am trying to do the following: The user chooses a cell via an InputBox (the cell contains a date); then the macro needs to switch to another sheet an find this value/the date in Column "A" and activate it. I just don't know how to adress it ... Can anybody help? Thanks, Maria |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Maria,
Try this Dim ans Dim c As Range ans = InputBox("Input date") If Not IsDate(ans) Then MsgBox "Invalid date" Exit Sub Else Worksheets("Sheet2").Activate Set c = Columns(1).Find(ans, LookIn:=xlValues) If Not c Is Nothing Then c.Activate End If End If -- HTH RP (remove nothere from the email address if mailing direct) "Maria" wrote in message ... Hello! I am trying to do the following: The user chooses a cell via an InputBox (the cell contains a date); then the macro needs to switch to another sheet an find this value/the date in Column "A" and activate it. I just don't know how to adress it ... Can anybody help? Thanks, Maria |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Many thanks, it worked out!
Maria -----Original Message----- Hi Maria, Try this Dim ans Dim c As Range ans = InputBox("Input date") If Not IsDate(ans) Then MsgBox "Invalid date" Exit Sub Else Worksheets("Sheet2").Activate Set c = Columns(1).Find(ans, LookIn:=xlValues) If Not c Is Nothing Then c.Activate End If End If -- HTH RP (remove nothere from the email address if mailing direct) "Maria" wrote in message ... Hello! I am trying to do the following: The user chooses a cell via an InputBox (the cell contains a date); then the macro needs to switch to another sheet an find this value/the date in Column "A" and activate it. I just don't know how to adress it ... Can anybody help? Thanks, Maria . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maria,
You could pass the date received from the message box to the following sub. This assumes that the Programmatic name of the sheet you have the list on is Sheet2 and that the range is from A1 to A100. Modify the code appropriately. Sub Switch(ByVal d As Double) Dim lRow& On Error Resume Next lRow = WorksheetFunction.Match(d, Sheet2.Range("A1:A100"), 0) On Error GoTo 0 If lRow < 0 Then Sheet2.Activate Sheet2.Cells(lRow, 1).Select End If End Sub "Maria" wrote: Hello! I am trying to do the following: The user chooses a cell via an InputBox (the cell contains a date); then the macro needs to switch to another sheet an find this value/the date in Column "A" and activate it. I just don't know how to adress it ... Can anybody help? Thanks, Maria |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Many thanks for your help!
-----Original Message----- Maria, You could pass the date received from the message box to the following sub. This assumes that the Programmatic name of the sheet you have the list on is Sheet2 and that the range is from A1 to A100. Modify the code appropriately. Sub Switch(ByVal d As Double) Dim lRow& On Error Resume Next lRow = WorksheetFunction.Match(d, Sheet2.Range ("A1:A100"), 0) On Error GoTo 0 If lRow < 0 Then Sheet2.Activate Sheet2.Cells(lRow, 1).Select End If End Sub "Maria" wrote: Hello! I am trying to do the following: The user chooses a cell via an InputBox (the cell contains a date); then the macro needs to switch to another sheet an find this value/the date in Column "A" and activate it. I just don't know how to adress it ... Can anybody help? Thanks, Maria . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to extract zip code from a 1 cell adress line? | Excel Discussion (Misc queries) | |||
Excel Formula for Single Cell Adress | Excel Worksheet Functions | |||
Return cell adress for next non-blank cell in a range | Excel Worksheet Functions | |||
How do I put an adress in a cell in multiple lines?? | Excel Discussion (Misc queries) | |||
Find value and adress | Excel Programming |