Using VBA, is it possible to get the size of a given range in terms of pixels or units? (I don't care which unit as I am only using it to relate to other measurements with the same unit).
Thanks.
Enter the formula =IF(A1:A10>5,"MAX") into cell B1. In cell B2, enter the formula =MIN(A1:A10). Subtract the two formulas by entering =B2-B1 into cell C1. You now have the range of your data.
To count rows using VBA, you need to define the range from which you want to count the rows and then use the count and rows property to get the count of the row from that range. You can also use a loop to count rows where you have data only.
The overall dimensions of a range are in its Width
and Height
properties.
Dim r As Range Set r = ActiveSheet.Range("A4:H12") Debug.Print r.Width Debug.Print r.Height
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With