Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default worksheet select using variable

I am trying to figure out how to modify the code to select a worksheet based
on a cell. I have new worksheets every day that are labeled in a manor as
this: November 8, 2005 and November 7, 2005 , etc... I have a data validation
list and a button. The list contains the names of the worksheets and I want
to beable to use the drop and then hit the button to activate that sheet.
This is what I have so far and cannot think of where to go from here.

Sub Button8_Click()
Dim sh As Worksheet
Dim rng As Range
Set sh = Sheets("indvdl")
Set rng = sh.Range("a9")

Worksheets.Select = rng
End Sub

I even tried this:

Sub Button8_Click()
Dim sh As Worksheet
Dim rng As Range
Set sh = Sheets("indvdl")
Set rng = sh.Range("a9")

Worksheets("A9").Select
End Sub

Any help please.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default worksheet select using variable

Sub Button8_Click()
Dim sh As Worksheet
Dim rng As Range
Set sh = Sheets("indvdl")
Set rng = sh.Range("a9")

sh.Activate
rng.Select ' If you want to select that range
End Sub

"Kryer" wrote:

I am trying to figure out how to modify the code to select a worksheet based
on a cell. I have new worksheets every day that are labeled in a manor as
this: November 8, 2005 and November 7, 2005 , etc... I have a data validation
list and a button. The list contains the names of the worksheets and I want
to beable to use the drop and then hit the button to activate that sheet.
This is what I have so far and cannot think of where to go from here.

Sub Button8_Click()
Dim sh As Worksheet
Dim rng As Range
Set sh = Sheets("indvdl")
Set rng = sh.Range("a9")

Worksheets.Select = rng
End Sub

I even tried this:

Sub Button8_Click()
Dim sh As Worksheet
Dim rng As Range
Set sh = Sheets("indvdl")
Set rng = sh.Range("a9")

Worksheets("A9").Select
End Sub

Any help please.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default worksheet select using variable

I am looking to select a different worksheet(November 8, 2005) based on the
value in activesheet("indivdl").range("A9")

So if I am on activesheet("indivdl") and i pull down the value in
range("A9") that states November 7, 2005. Then I want the activesheet to move
from being "indivdl" to "November 7, 2005"


"Jason Clement" wrote:

Sub Button8_Click()
Dim sh As Worksheet
Dim rng As Range
Set sh = Sheets("indvdl")
Set rng = sh.Range("a9")

sh.Activate
rng.Select ' If you want to select that range
End Sub

"Kryer" wrote:

I am trying to figure out how to modify the code to select a worksheet based
on a cell. I have new worksheets every day that are labeled in a manor as
this: November 8, 2005 and November 7, 2005 , etc... I have a data validation
list and a button. The list contains the names of the worksheets and I want
to beable to use the drop and then hit the button to activate that sheet.
This is what I have so far and cannot think of where to go from here.

Sub Button8_Click()
Dim sh As Worksheet
Dim rng As Range
Set sh = Sheets("indvdl")
Set rng = sh.Range("a9")

Worksheets.Select = rng
End Sub

I even tried this:

Sub Button8_Click()
Dim sh As Worksheet
Dim rng As Range
Set sh = Sheets("indvdl")
Set rng = sh.Range("a9")

Worksheets("A9").Select
End Sub

Any help please.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default worksheet select using variable


Worksheets(Range("A9").Value).Select

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Kryer" wrote in message
...
I am looking to select a different worksheet(November 8, 2005) based on

the
value in activesheet("indivdl").range("A9")

So if I am on activesheet("indivdl") and i pull down the value in
range("A9") that states November 7, 2005. Then I want the activesheet to

move
from being "indivdl" to "November 7, 2005"


"Jason Clement" wrote:

Sub Button8_Click()
Dim sh As Worksheet
Dim rng As Range
Set sh = Sheets("indvdl")
Set rng = sh.Range("a9")

sh.Activate
rng.Select ' If you want to select that range
End Sub

"Kryer" wrote:

I am trying to figure out how to modify the code to select a worksheet

based
on a cell. I have new worksheets every day that are labeled in a manor

as
this: November 8, 2005 and November 7, 2005 , etc... I have a data

validation
list and a button. The list contains the names of the worksheets and I

want
to beable to use the drop and then hit the button to activate that

sheet.
This is what I have so far and cannot think of where to go from here.

Sub Button8_Click()
Dim sh As Worksheet
Dim rng As Range
Set sh = Sheets("indvdl")
Set rng = sh.Range("a9")

Worksheets.Select = rng
End Sub

I even tried this:

Sub Button8_Click()
Dim sh As Worksheet
Dim rng As Range
Set sh = Sheets("indvdl")
Set rng = sh.Range("a9")

Worksheets("A9").Select
End Sub

Any help please.



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
Select a variable range Bluecat Excel Worksheet Functions 7 January 13th 09 01:24 AM
select cell by variable name Adam Excel Discussion (Misc queries) 6 May 20th 08 07:54 PM
In Excel 2000, How do you select the whole of a worksheet (Select. Rascal Excel Discussion (Misc queries) 1 March 5th 05 12:03 AM
In Excel 2000, How do you select the whole of a worksheet (Select. Rascal Excel Discussion (Misc queries) 1 March 4th 05 11:59 PM
Select workbook with variable name. FinChase Excel Programming 1 November 12th 04 07:18 PM


All times are GMT +1. The time now is 11:15 AM.

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"