Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Range object containing all cells of a worksheet

Tags:

excel

vba

I am looking for a command that creates a Range Object containing all cells of a given worksheet.

Sheets(1).Range("A1:AAZ1000000") would be a safe bet, but you never know how many rows or columns you might encounter so something like Sheets(1).Range("All") would be better.

like image 468
Christian Avatar asked Dec 12 '25 02:12

Christian


1 Answers

Sheets(1).Cells returns a Range object and when called with no parameters returns a range encompassing all the cells in the sheet.

like image 54
Alex K. Avatar answered Dec 14 '25 20:12

Alex K.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!