![]() |
indicating sheet
Is there a way of telling a macro to run in the specified sheet, without using:
Worksheets("Sheet1").<property Can I use a refrence like this.<property or me.<property? I'm looking to do some formatting of a sheet in VBA, setting the page orientation, and Print Area. The name of the sheet may change from instance to instance though, so I don't want to put in a static page name. Thank you in advance for any help offered. |
indicating sheet
If you have activated the sheet you can use
ActiveSheet else use the sheet index Sheets(n) where n is the sheet position in the activeworkbook -- Cheers Nigel "RSteph" wrote in message ... Is there a way of telling a macro to run in the specified sheet, without using: Worksheets("Sheet1").<property Can I use a refrence like this.<property or me.<property? I'm looking to do some formatting of a sheet in VBA, setting the page orientation, and Print Area. The name of the sheet may change from instance to instance though, so I don't want to put in a static page name. Thank you in advance for any help offered. |
indicating sheet
If it is the first shee in the workbook, maybe:
Sheets(1).<property Regards, Paul "RSteph" wrote in message ... Is there a way of telling a macro to run in the specified sheet, without using: Worksheets("Sheet1").<property Can I use a refrence like this.<property or me.<property? I'm looking to do some formatting of a sheet in VBA, setting the page orientation, and Print Area. The name of the sheet may change from instance to instance though, so I don't want to put in a static page name. Thank you in advance for any help offered. |
indicating sheet
I got it working by using ActiveSheet. I didn't think I could use that
without declaring an active sheet first, but it worked. There's only one sheet in the workbook, so that helps. "PCLIVE" wrote: If it is the first shee in the workbook, maybe: Sheets(1).<property Regards, Paul "RSteph" wrote in message ... Is there a way of telling a macro to run in the specified sheet, without using: Worksheets("Sheet1").<property Can I use a refrence like this.<property or me.<property? I'm looking to do some formatting of a sheet in VBA, setting the page orientation, and Print Area. The name of the sheet may change from instance to instance though, so I don't want to put in a static page name. Thank you in advance for any help offered. |
All times are GMT +1. The time now is 05:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com