ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Counting rows in a range (https://www.excelbanter.com/excel-programming/365645-counting-rows-range.html)

Gert-Jan

Counting rows in a range
 
I need some help with the following: I have a (dynamic) range called
rangetest. I want to show some data in a userform, with buttons "next" and
"previous". But I don't now how to count the rows in my range (see the code
below).

Any help would be appriciated!!

i = rangetest + 1
vrijwap.Caption = Cells(i, 5).Value
vrijwuw.Caption = Cells(i, 6).Value
vrijwwj.Caption = Cells(i, 7).Value
profap.Caption = Cells(i, 8).Value
profuw.Caption = Cells(i, 9).Value
profwj.Caption = Cells(i, 10).Value
next.Enabled = i < swapalles.Rows.Count / ListCount - wrong!!
previous.Enabled = i 1



Bob Phillips

Counting rows in a range
 
I have no idea what ListCount is, but

swapalles.Rows.Count

is correct fro counting the row

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Gert-Jan" wrote in message
...
I need some help with the following: I have a (dynamic) range called
rangetest. I want to show some data in a userform, with buttons "next" and
"previous". But I don't now how to count the rows in my range (see the

code
below).

Any help would be appriciated!!

i = rangetest + 1
vrijwap.Caption = Cells(i, 5).Value
vrijwuw.Caption = Cells(i, 6).Value
vrijwwj.Caption = Cells(i, 7).Value
profap.Caption = Cells(i, 8).Value
profuw.Caption = Cells(i, 9).Value
profwj.Caption = Cells(i, 10).Value
next.Enabled = i < swapalles.Rows.Count / ListCount - wrong!!
previous.Enabled = i 1






All times are GMT +1. The time now is 10:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com