Define a range globally
I have many macros that create separate pivot tables (on separate
sheets) based on the same range (my data source sheet). I tried defining the range globally but I get errors. I.E. In module1: Public rngRawData as range Then in the workbook_open event I want to set the range: Set rngRawData = ActiveWorkbook.Sheets("Data").Range("R1C1:R981C30" ) I get an object-defined or application-defined error. Can someone please tell me what I'm doing wrong? Thanks, Debbie |
Define a range globally
Debbie:
It worked for me if I used A1 notation: Range("$A$1:$AD$981") You can use Application.ConvertFormula("R1C1:R981C30", xlR1C1, xlA1) to convert from R1C1 if necessary. -- George Nicholson Remove 'Junk' from return address. "Debbie" wrote in message om... I have many macros that create separate pivot tables (on separate sheets) based on the same range (my data source sheet). I tried defining the range globally but I get errors. I.E. In module1: Public rngRawData as range Then in the workbook_open event I want to set the range: Set rngRawData = ActiveWorkbook.Sheets("Data").Range("R1C1:R981C30" ) I get an object-defined or application-defined error. Can someone please tell me what I'm doing wrong? Thanks, Debbie |
All times are GMT +1. The time now is 04:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com