do while not the last cell in column A is blank

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

do while not the last cell in column A is blank

Post by sal21 »

i'm using this

...
Set oXLSheet = oXLBook.Worksheets("categorie")
...

now i need to loop column A from row 1 to the and of last cell is blank...
how to?


note:
i'm on VB6

User avatar
HansV
Administrator
Posts: 78241
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: do while not the last cell in comun A is blank

Post by HansV »

Code: Select all

    Set oXLSheet = oXLBook.Worksheets("categorie")
    Dim UltimaRiga As Long
    Dim Riga As Long
    With oXLSheet
        UltimaRiga = .Range("A" & .Rows.Count).End(-4162).Row
        For Riga = 1 To UltimaRiga
            ' Do something with .Range("A" & Riga)
        Next Riga
    End With
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

Re: do while not the last cell in comun A is blank

Post by sal21 »

HansV wrote:
17 Jan 2023, 22:10

Code: Select all

    Set oXLSheet = oXLBook.Worksheets("categorie")
    Dim UltimaRiga As Long
    Dim Riga As Long
    With oXLSheet
        UltimaRiga = .Range("A" & .Rows.Count).End(-4162).Row
        For Riga = 1 To UltimaRiga
            ' Do something with .Range("A" & Riga)
        Next Riga
    End With
Tks, bro and sorry me but just post a similar question, now found in old email.