In VBA, I’m trying to determine several characteristics of the active sheet in terms of where data begins and ends. Specific pieces I’m looking for are:
Column where first data appears
Column where last data appears
Row where first data appears
Row where last data appears
At this point, I’m not concerned about whether the cell physically contains anything. I know Excel treats empty but formatted cells as being part of the range. I’m OK with that. I’ve only gotten this far by searching literally dozens of posts and trying out various formulas without success.
What I think I’ve concluded is that if I use the following command, I can select the entire data range. Is there a way that I can populate a variable with that selected range, e.g., Rng = “A1:J80”? From there, I can start figuring out how to decode the variable into its components and derive the other pieces .
ActiveSheet.Range([A1], Cells.SpecialCells(xlCellTypeLastCell)).Select
As a follow-on to that, the above formula assumes that the selection range begins in A1. However, that may not be the first cell that data begins, e.g., the data range may actually be C13 :L92. Does anyone know how to achieve this?
Any help or pointers will be appreciated.
Excel 2007
Column where first data appears
Column where last data appears
Row where first data appears
Row where last data appears
At this point, I’m not concerned about whether the cell physically contains anything. I know Excel treats empty but formatted cells as being part of the range. I’m OK with that. I’ve only gotten this far by searching literally dozens of posts and trying out various formulas without success.
What I think I’ve concluded is that if I use the following command, I can select the entire data range. Is there a way that I can populate a variable with that selected range, e.g., Rng = “A1:J80”? From there, I can start figuring out how to decode the variable into its components and derive the other pieces .
ActiveSheet.Range([A1], Cells.SpecialCells(xlCellTypeLastCell)).Select
As a follow-on to that, the above formula assumes that the selection range begins in A1. However, that may not be the first cell that data begins, e.g., the data range may actually be C13 :L92. Does anyone know how to achieve this?
Any help or pointers will be appreciated.
Excel 2007