How do you select the entire excel sheet with Range using VBA?
you can use all cells as a object like this :
Dim x as Range
Set x = Worksheets("Sheet name").Cells
X is now a range object that contains the entire worksheet
I believe you want to find the current region of A1 and surrounding cells - not necessarily all cells on the sheet. If so - simply use... Range("A1").CurrentRegion
You can simply use cells.select
to select all cells in the worksheet. You can get a valid address by saying Range(Cells.Address)
.
If you want to find the last Used Range
where you have made some formatting change or entered a value in you can call ActiveSheet.UsedRange
and select it from there. Hope that helps