Macor Needed

heather

New Member
Joined
Apr 8, 2002
Messages
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.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
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
 
Upvote 0
On 2002-04-09 11:57, heather wrote:
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.

Hi Heather,

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
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,695
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top