Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro Code- create new worksheet

Status
Not open for further replies.

kpizza

Technical User
Jul 13, 2006
34
US
I want to create a new worksheet which will be called Customer_Equipment_List (can be considered duplicate of referenced worksheet) using same code I included here but that will be provide me an active worksheet instead of a Print Preview page.

I’ll appreciate your help. Thanks!

Code for Excel Report:

Sub Excel_Equipment_List()
'
' Excel_Equipment_List Macro
'
Application.ScreenUpdating =
Call hide_zeros_equipment
With ActiveSheet.PageSetup
.Orientation = xlPortrait
.PrintArea = "$A$630:$I$2160"
.PrintTitleRows = "$630:$645"
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 50
.PaperSize = xlPaperLetter
.TopMargin = Application.InchesToPoints(0.25)
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
End With
ActiveSheet.PrintPreview
Application.ScreenUpdating = True
Range("A646").Select
End Sub


~Krista~
 
Not very clear what you are after I am afraid.

Switch on the macro recorder then
either
Insert, Worksheet
OR
Right click the sheet tab and choose "Move or Copy"

Stop the macro recorder and review/edit the recorded code. Post back what you have if you get stuck



Gavin
 
kpizza,

You really need to post your question over in forum707.

And you definitely need to provide more detail:
1. What are you trying to do?
2. Are you getting any error messages? If so, what?
3. If error messages, what line(s) of code are highlighted when you get the messages?
4. Or what is the program NOT doing?
5. Or if you're just not getting there... where have you gotten?

Anyway, provide as much detail such as this as possible.
 
As KJV said, you should post this over in forum707.

But this jumped out at me:
kpizza said:
but that will be provide me an active worksheet instead of a Print Preview page.
If you don't want to see the sheet in Print Preview, then this line seems out of place:
[tab]ActiveSheet.PrintPreview


[tt][blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top