macro prob, is this to tricky?

Kade

Active Member
Joined
Jul 20, 2002
Messages
258
Hi all, I posted this prob recently but no replies, maybe I made it to tricky, anyhow I will try and explain less complicated. :)


This macro is to create a view that uses the sheet tab name as part of its name eg: if the macro is run in sheet 3 it will call the view "sheet3 concatanate with "A".

It does not need to to change if the sheet name changes. Once created with the tab name text all is well.


Sub Macro1()
'
' Macro1 Macro
' Macro recorded 13/09/2002 by Kade
'

'
Range("A1:G17").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$G$17"
Range("A1").Select
ActiveWorkbook.CustomViews.Add ViewName:="INSERT THE NAME OF SHEET3 CONCATANATE WITH "A" HERE", PrintSettings:=True, _
RowColSettings:=True
End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hi,

Try the following...

<pre>Sub test()
Dim view_name As String

With ActiveSheet
view_name = .Name & "A"
.PageSetup.PrintArea = "$A$1:$G$17"
End With

ActiveWorkbook.CustomViews.Add ViewName:=view_name, _
PrintSettings:=True, RowColSettings:=True

End Sub</pre?
 
Upvote 0
Thankyou Jay, this is saving me heaps of time, I can now go to the pub early!
 
Upvote 0

Forum statistics

Threads
1,203,146
Messages
6,053,755
Members
444,681
Latest member
Nadzri Hassan

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