![]() |
find range size
so i have a range named Range("DRP")
that range is always changing, and i would like to know how many cells wide and long it is.. for example....if currenty Range DRP is from A1:D5, i want to know that it spans 5 columns and 4 rows. |
find range size
"Nigel" skrev i en meddelelse
ups.com... so i have a range named Range("DRP") that range is always changing, and i would like to know how many cells wide and long it is.. for example....if currenty Range DRP is from A1:D5, i want to know that it spans 5 columns and 4 rows. Nigel Number of columns: Range("DRP").Columns.Count Nuber of rows: Range("DRP").Rows.Count -- Best regards Leo Heuser Followup to newsgroup only please. |
find range size
Hi
Range("DRP").Rows.Count Range("DRP").Columns.Count If you give the range a name and declare it as a range variable Dim myRange as Range Set myRange = Range("DRP") then you will get the drop down menus for the range objects properties and methods as you type. regards Paul Nigel wrote: so i have a range named Range("DRP") that range is always changing, and i would like to know how many cells wide and long it is.. for example....if currenty Range DRP is from A1:D5, i want to know that it spans 5 columns and 4 rows. |
find range size
A named range is just a string that represents the range. So:
Sub rover() MsgBox (Range("Nigel").Count) MsgBox (Range("Nigel").Address) MsgBox (Range("Nigel").Rows.Count) MsgBox (Range("Nigel").Columns.Count) End Sub Will tell you how many cells are in the range, it over-all dimensions and the number of rows and columns. Have a pleasant day! -- Gary's Student "Nigel" wrote: so i have a range named Range("DRP") that range is always changing, and i would like to know how many cells wide and long it is.. for example....if currenty Range DRP is from A1:D5, i want to know that it spans 5 columns and 4 rows. |
find range size
Nigel
Try this one Sub Macro1() For Each Column In ActiveSheet.Range("DRP").Columns x = x + 1 Next For Each Row In ActiveSheet.Range("DRP").Rows y = y + 1 Next MsgBox "There are " & x & " Columns and " & y & " Rows" End Sub Regards Piet Nigel schreef: so i have a range named Range("DRP") that range is always changing, and i would like to know how many cells wide and long it is.. for example....if currenty Range DRP is from A1:D5, i want to know that it spans 5 columns and 4 rows. |
find range size
=ROWS(DRP)
=COLUMNS(DRP) Regards, Stefi €žNigel€ť ezt Ă*rta: so i have a range named Range("DRP") that range is always changing, and i would like to know how many cells wide and long it is.. for example....if currenty Range DRP is from A1:D5, i want to know that it spans 5 columns and 4 rows. |
All times are GMT +1. The time now is 07:44 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com