View Full Version : auto create text
who can :help 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
Bob Phillips
11-05-2009, 12:50 AM
What is the question?
how can i use for loop to :help 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
Bob Phillips
11-05-2009, 03:07 AM
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.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.