Results 1 to 6 of 6

Thread: VBA Excel - For... next instruction

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    VBA Excel - For... next instruction

    Hi, I'm trying to get cell values starting from A22.. and then A23, etc. each cycle from my for instruction
    The firt module is working fine, however with test1 module is writing all the time A22 value.

    Sub Create_RO()
    Dim total() As Variant
    Dim maximo As Long
    Dim i As Long
    maximo = Range("A21").Value
    ReDim total(1 To maximo)
    For i = 1 To maximo
         total(i) = i
    Next i
    total = Application.Transpose(total)
    Range("A22").Resize(UBound(total)).Value = total
    End Sub
    
    
    Sub test1()
    For x = 22 To (21 + Range("A21").Value)
    Cells(x, 2) = "MSAI0" & Range("D4") & "L" & Range("C18") & "0" & Range("A22") & "RO" & Range("J4") & Range("K4")
    Next
    End Sub
    Can you help me with this please?

    Thank you
    Last edited by Aussiebear; 10-24-2023 at 04:40 PM. Reason: Reduced the whitespace

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •