primuspaul
Board Regular
- Joined
- Dec 23, 2015
- Messages
- 75
- Office Version
- 2021
- 2019
- Platform
- Windows
I want to print certain areas of various sheets in a workbook based on user input.
The file has multiple Names and those names refer to various parts of the file. Some Names refer to multiple areas on multiple sheets and some of those sheets have names with spaces in them (which also caused problems in my tests).
What is the right way to do this? L2 on some Sheet1 would have text like PrintArea1 or PrintArea2 and PrintArea1 and PrintArea2 would also be the names of some of those print area names. How do I do this?
Code:
Sub PAREA()
Dim xy As String
xy = .Cells(L, 2).Text
Range(xy).PrintOut Preview:=True
End Sub
The file has multiple Names and those names refer to various parts of the file. Some Names refer to multiple areas on multiple sheets and some of those sheets have names with spaces in them (which also caused problems in my tests).
What is the right way to do this? L2 on some Sheet1 would have text like PrintArea1 or PrintArea2 and PrintArea1 and PrintArea2 would also be the names of some of those print area names. How do I do this?