Sintax Help!

  • Thread starter Thread starter Smonczka
  • Start date Start date
S

Smonczka

I would like to print a sheet and a graph from a macro. I would like
to call both by the Number and not the Name of each. In other words if
the sheet was named Chart10 (BoxTops)I need to be able to call the
sheet by "Chart10" not "boxtops". This way if the name changes the
macro will still work.

Somthing like...

Sub test()
'
' test Macro
' Macro recorded 5/23/2005 by
'
'Print Chart
Sheets("chart12").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

But my macro errors out on the first line. How to you call a sheet by
the number not the name?

Thanks,
Steve
(e-mail address removed)
 
Do you mean?

Chart12.Select



--

HTH

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

Yes that is what I needed. So you dont have to type in the name you
just type in the sheetnumber.select.

That did what I wanted it to do, Thanks.

Steve
 
No, I was pointing you at the sheet's code name which does not change if the
user changes the sheet name in Excel.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Bob, sorry if I didn't explain well enough. But what you gave me was
exactly what I was looking for. :)

I modified my code using the example you gave me and now I don't have
to worry about changes made to the sheet names.

Thanks again.
Steve
 
Back
Top