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. :smile:


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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
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

Forum statistics

Threads
1,224,900
Messages
6,181,632
Members
453,059
Latest member
jkevin

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