Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Select sheet based on cell value

Could someone help me with some code? I have a workbook with twelve
worksheets named A, B,... I, J, Formula and Menu. On the Formula
sheet, I have the following range of cells:

A B C
1 10 A 30
2 20 B
3 30 C
....
9 90 I
10 100 J

Based on the value of cell formula!C1 (which is 30) I would like to
run a macro from the Menu sheet that will look up 30 in the range
Formula!A1:B10 and return the value "C" to the macro that will select
the worksheet named "C". Or, if there is a better way please let me
know.

TIA,

Dan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Select sheet based on cell value

Dan,

This is what you want

On Error Resume Next
Worksheets(WorksheetFunction.VLookup(Range("C1"), Range("A1:B10"), 2,
False)).Activate


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Dan Mills" wrote in message
m...
Could someone help me with some code? I have a workbook with twelve
worksheets named A, B,... I, J, Formula and Menu. On the Formula
sheet, I have the following range of cells:

A B C
1 10 A 30
2 20 B
3 30 C
...
9 90 I
10 100 J

Based on the value of cell formula!C1 (which is 30) I would like to
run a macro from the Menu sheet that will look up 30 in the range
Formula!A1:B10 and return the value "C" to the macro that will select
the worksheet named "C". Or, if there is a better way please let me
know.

TIA,

Dan



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Select sheet based on cell value

Try this Dan

I use the sheet name "menu" in this example

Sub test()
Dim Shname As String
With Sheets("Menu")
Shname = Application.WorksheetFunction.VLookup(.Range("C1") .Value, _
.Range("a1:b10"), 2)
End With
On Error Resume Next
Sheets(Shname).Select
On Error GoTo 0
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Dan Mills" wrote in message m...
Could someone help me with some code? I have a workbook with twelve
worksheets named A, B,... I, J, Formula and Menu. On the Formula
sheet, I have the following range of cells:

A B C
1 10 A 30
2 20 B
3 30 C
...
9 90 I
10 100 J

Based on the value of cell formula!C1 (which is 30) I would like to
run a macro from the Menu sheet that will look up 30 in the range
Formula!A1:B10 and return the value "C" to the macro that will select
the worksheet named "C". Or, if there is a better way please let me
know.

TIA,

Dan



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
graph based on the city i select in a particular cell Nikhil Charts and Charting in Excel 1 May 26th 09 01:19 PM
Using VBA select sll sheets based on Criteria on each sheet. AirgasRob Excel Discussion (Misc queries) 4 September 3rd 08 03:11 PM
Select a cell based on an other cell's value wally_91 Excel Worksheet Functions 4 March 13th 08 12:24 AM
how can I select a range of cells based on a value of a cell? grigoras victor Excel Discussion (Misc queries) 1 June 26th 06 04:55 PM
Select Columns based on cell value No Name Excel Programming 1 November 13th 03 09:31 AM


All times are GMT +1. The time now is 05:29 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"