![]() |
determine selection.Address of cell from inactive sheet?
Hello,
My report page displays formula based data from the data sheet. I need to increment up data data sheet (remove data from the lower row and then read data in the current row). The catch is that I don't want to leave the report sheet to move up to the next row in the data sheet. So is there a way to determine what row the data sheet is on without having to activate it? I noticed that selection.Address only works with ActiveSheets. Thanks, Rich |
determine selection.Address of cell from inactive sheet?
Well, I came up with this: I have to prime the system by writing the current
row number of the data sheet in a cell in the report sheet. I read that number from my macro code and then decrement it by one and write the new number (which is the next upper row in the data sheet) in the cell in the report sheet. The the macro does its thing to the data sheet. Any suggestions appreciated if there is a better way to do this. "Rich" wrote: Hello, My report page displays formula based data from the data sheet. I need to increment up data data sheet (remove data from the lower row and then read data in the current row). The catch is that I don't want to leave the report sheet to move up to the next row in the data sheet. So is there a way to determine what row the data sheet is on without having to activate it? I noticed that selection.Address only works with ActiveSheets. Thanks, Rich |
determine selection.Address of cell from inactive sheet?
Rich, the "Selection" object, without a specifier infront of it, implies
Activesheet.Selection. Therefore, it only replies to the activesheet. You can use worksheets("Data").selection.address and worksheets("Report").selection.address to specify what you want on each sheet. You may want to research some on implicit and explicit variables to ensure that you are always using the proper objects. Whenever possible, it is best to use explicit variables. Let me know if you'd like more info on this. Regards, Bill "Rich" wrote: Well, I came up with this: I have to prime the system by writing the current row number of the data sheet in a cell in the report sheet. I read that number from my macro code and then decrement it by one and write the new number (which is the next upper row in the data sheet) in the cell in the report sheet. The the macro does its thing to the data sheet. Any suggestions appreciated if there is a better way to do this. "Rich" wrote: Hello, My report page displays formula based data from the data sheet. I need to increment up data data sheet (remove data from the lower row and then read data in the current row). The catch is that I don't want to leave the report sheet to move up to the next row in the data sheet. So is there a way to determine what row the data sheet is on without having to activate it? I noticed that selection.Address only works with ActiveSheets. Thanks, Rich |
All times are GMT +1. The time now is 10:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com