Consulting

Results 1 to 2 of 2

Thread: Solved: for loop

  1. #1
    VBAX Regular
    Joined
    Oct 2009
    Posts
    14
    Location

    Exclamation Solved: for loop

    Hi, i'm trying to achieve something look like the screen shot using 'for loop'.

    my 'for loop' is poor. anyone can help ?

    here is my code

    Dim r As Range
    Dim i As Integer
    r = Range("H2:H61")
    With r
    For c = 1 To 20
    For i = 1 To 3
    If i = 1 Then
    .Cells = "Rev ('000)"
    Else
    If i = 2 Then
    .Cells = "FEU"
    Else
    If i = 3 Then
    .Cells = "Rev/F"
    End If
    Next i
    Next c
    End With
    Last edited by waka; 11-06-2009 at 01:37 AM.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Dim c As Long

    For c = 2 To 61 Step 3

    Cells(c, "h").Resize(3).Value = Application.Transpose(Array("Rev ('000)", "FEU", "Rev/F"))
    Next c
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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