![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 8
|
Green user of excel, yet have manager’s who like cool stuff.
I need a macro that will look at cell E12 of the tab entitled “worksheet” and depending on the value of E12 it will print the tab “A” or tab “b” or tab “c”. I dug around in the past posts but can’t find it. I think it is an If and else if statement but can’t seem to make it work. Any help? Thanks. |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
It can be done in an if statement, try the following:
If Worksheets("Worksheet").[e12].Value = "A" Then Worksheets("A").PrintOut ElseIf Worksheets("Worksheet").[e12].Value = "B" Then Worksheets("B").PrintOut ElseIf Worksheets("Worksheet").[e12].Value = "C" Then Worksheets("C").PrintOut End If
__________________
Kind regards, Al Chara |
|
|
|
|
|
#3 |
|
New Member
Join Date: Apr 2002
Posts: 8
|
That seems to easy. I will give it a try. Thanks!
|
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Quote:
What are the values that are allowed in E12. What criteria determines which sheet? If all you will place in the cell is "A", "B", or "C" then try: ------------------------ Sub print_choice() Dim RangeVal As String On Error Resume Next RangeVal = Sheets("Worksheet").Range("E12") Sheets(RangeVal).PrintOut On Error Goto 0 End Sub ------------------- If there are other worksheet selection paramters, then please post back. Bye, Jay |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|