Consulting

Results 1 to 4 of 4

Thread: auto create text

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

    Question auto create text

    who can about my column 2 and 3?

    here is my sample code.
    Sub forloop()
    Dim c As Integer
     
    ActiveSheet.Range("A1") = "Year"
    For c = 2 To 61
    ActiveSheet.Range("A" & c) = "2009"
    Activesheet.Range("B" & c) = "A1"
    Next c
     
    End Sub

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    What is the question?
    ____________________________________________
    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

  3. #3
    VBAX Regular
    Joined
    Oct 2009
    Posts
    14
    Location
    how can i use for loop to me to get my output (screenshot) whenever i create a new work sheet? i'm stuck at column 2 and 3. my code only works for column 1. i try this code at my column 3

    For count = 2 To 61
    If count >= 4 Then
    ActiveSheet.Range("D2:D4") = "2"
    Else
    If count >= 7 Then
    ActiveSheet.Range("D5:D7") = "1"
    End If
     
    Next count

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    It is impossible to say at present because you haven'y explained the rules for setting the values to 1 or 2, why sometimes there are 3, sometimes a lot more.
    ____________________________________________
    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
  •