Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA count number of cells
I am counting number of cells i have to iterate with next piece of code:
Dim rows Do While Not (IsEmpty(ActiveCell)) rows = ActiveCell.Row ActiveCell.Offset(1, 0).Select Loop is it possible to do the same without selecting? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA count number of cells
Hi,
It's always a good idea to post code/formula you have tried but the snippet of code you supplied will go into a very long and probably endless loop if run so avoid doing that. Perhaps you could explain more clearly what you are trying to do. Mike "filip" wrote: I am counting number of cells i have to iterate with next piece of code: Dim rows Do While Not (IsEmpty(ActiveCell)) rows = ActiveCell.Row ActiveCell.Offset(1, 0).Select Loop is it possible to do the same without selecting? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA count number of cells
Hi
Do not use Rows as a variable, it's already used in VBA. Is ActiveCell always in row 1, otherwise you may wish to subtract ActiveCell.Row from the result below. Look at this: Dim Target as Range Dim RowCount as Integer Set Target = ActiveCell Do While Not (IsEmpty(Target)) RowCount = Target.Row Set Target = Target.Offset(1, 0) Loop 'or RowCount = ActiveCell.End(xlDown).Row Regards, Per "filip" skrev i meddelelsen ... I am counting number of cells i have to iterate with next piece of code: Dim rows Do While Not (IsEmpty(ActiveCell)) rows = ActiveCell.Row ActiveCell.Offset(1, 0).Select Loop is it possible to do the same without selecting? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
count number of cells | Charts and Charting in Excel | |||
How do I count the number of cells | New Users to Excel | |||
Count Number of Different Cells | Excel Worksheet Functions | |||
count number of cells | Excel Worksheet Functions | |||
Count number of times a specific number is displayed in cells | Excel Programming |