One way:
RowsNo = Range(Left(Cells(1, Col).Address(False, False), 1 - (Col > 26)) &
Rows.Count).End(xlUp).Row
On Sheet2:
vRows = Worksheets("Sheet2").Range(Left(Cells(1, Col).Address(False, False),
1 - (Col > 26)) & Rows.Count).End(xlUp).Row
Don't use Rows as a variable name, it's a keyword!
Regards,
Stefi
„Sören_Marodören” ezt *rta:
> Hi,
>
> I use the following line to count rows in a column A
> Rows = Range("A" & Rows.Count).End(xlUp).Row
> (I dont't know if this is the best way, but it works.)
>
> Now I want to have a for loop that goes from column C to the last column
> and count the number of rows in every column.
>
> For Col = 3 to Last_Col
> Rows = ....
> Cells (1, Col) = Rows
> Next
>
> How shall the Row = ... be written to count the number of rows in column Col?
> How can it be written to count columns in another worksheet?
>
>
> Best regards,
> /Sören Nilsson
> Sweden
|