Offset ActiveSheet.Name into ActiveWorkbook.Names

Fubi

New Member
Joined
Jul 27, 2022
Messages
5
Office Version
  1. 365
Hello members!


When i look inside the name manager the formula is wrapped into apostrof's.
Because of that my vba code below doesn't work. Without apostrof's the vba code won't even run.

Can someone show me a solution for this problem?

VBA Code:
Sub Productieprint()

    ActiveWorkbook.Names("DynPrint").RefersToR1C1 = "=OFFSET('" & ActiveSheet.Name & "'!R2C6,0,0,COUNTA('" & ActiveSheet.Name & "'!C6),4)"
    Application.CutCopyMode = False

    Sheets(ActiveSheet.Name).PageSetup.Orientation = xlPortrait

    ActiveWorkbook.Worksheets(ActiveSheet.Name).Names("Print_Area").RefersToR1C1 = "=DynPrint"

End Sub

Kind regards
 

Attachments

  • 1664541801643.png
    1664541801643.png
    312 bytes · Views: 5

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Good to hear you got the solution.

If you would like to post the solution then it is perfectly fine to mark your post as the solution to help future readers. Otherwise, please do not mark a post that doesn't contain a solution.
 
Upvote 0
I know what you're trying to say. Actually what Jeffrey suggested did they trick. Thanks everyone.
 
Upvote 0
In that case feel free to mark post#4 as the solution.
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,191
Members
453,021
Latest member
pingpong7117

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