Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am writting some code and i am stuck on how to select a worksheet.
There is a month listed in cell A1 of Sheet1. It is a validated cell to select months. The rest of the Sheets are labeled named with months ie. January, February ... Based on what is in cell A1 on Sheet1, I woudl like the code to select the corresponding sheet. Any guidance at all woudl be appreciated. Here is what I ahve so far and it does not work at all. Sub Tryingsomething() Dim date1 As String date1 = Sheet1.Range("A1") Worksheets(date1).Range("A1").Select End Sub Jay |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You could use the following code:
Sub GoWhere() Dim ws As Worksheet Dim strMonth As String Set ws = ThisWorkbook.Sheets(1) strMonth = ws.Range("A1").Value Select Case strMonth Case "January", "February", "March", _ "April", "May", "June", "July", _ "August", "September", "October", _ "November", "December" ThisWorkbook.Sheets(strMonth).Activate ActiveSheet.Range("A1").Select Case Else End Select Set ws = Nothing End Sub -- Kevin Backmann "jlclyde" wrote: I am writting some code and i am stuck on how to select a worksheet. There is a month listed in cell A1 of Sheet1. It is a validated cell to select months. The rest of the Sheets are labeled named with months ie. January, February ... Based on what is in cell A1 on Sheet1, I woudl like the code to select the corresponding sheet. Any guidance at all woudl be appreciated. Here is what I ahve so far and it does not work at all. Sub Tryingsomething() Dim date1 As String date1 = Sheet1.Range("A1") Worksheets(date1).Range("A1").Select End Sub Jay |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sub Tryingsomething()
Sheets(Sheets("Sheet1").Range("A1").Value).Activat e Range("A1").Select End Sub -- Gary''s Student - gsnu200779 |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
On Apr 17, 10:17*am, Gary''s Student
wrote: Sub Tryingsomething() Sheets(Sheets("Sheet1").Range("A1").Value).Activat e Range("A1").Select End Sub -- Gary''s Student - gsnu200779 Thanks, this is eactly what I was looking for. I always seem to forget to activate the sheet before selecting something on it. Thanks again, Jay |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
selecting cells in different worksheets | Excel Discussion (Misc queries) | |||
Comment BUG- selecting cells on other worksheets | Excel Discussion (Misc queries) | |||
Selecting and viewing sum in status bar across worksheets | Excel Discussion (Misc queries) | |||
Selecting and summing across worksheets | Excel Discussion (Misc queries) | |||
Selecting across worksheets | Excel Discussion (Misc queries) |