I would appreciate knowing what I am doing wrong - could someone please point me in the right direction?
I get a Run-time error 9 on the below code.
if I replace x variable to a fix number in the line Cells(col, cy + 7) = Mycycle(x) to Cells(col, cy + 7) = Mycycle(1) it works but the cycles dont change of coarse. In the end there will be 30 to 40 cycles from a dat file with only a blank cell between the cycles
if there is a better way to do this type of array please let me know.
Thank you for any help
John
Sub findcycle()
'
'
Dim Mycycle(8) As String
Mycycle(1) = "cycle1"
Mycycle(2) = "cycle2"
Mycycle(3) = "cycle3"
Mycycle(4) = "cycle4"
Mycycle(5) = "cycle5"
Mycycle(6) = "cycle6"
Mycycle(7) = "cycle7"
Mycycle(8) = "cycle8"
Dim mycount
Dim col
Dim row
Dim cy
Dim x
mycount = 0
cy = 13
x = 1
Columns("A:A").Select
mycount = Range("A65536").End(xlUp).row
Cells(15, 17).Select
'sorts data
For col = 18 To mycount
If Cells(col, cy) <= "" Then
Cells(col, cy + 7) = Mycycle(x)
End If
If Cells(col, cy) = "" Then
If Cells(col + 8, cy) = "" Then GoTo estop
End If
x = x + 1
Next col
estop:
Erase Mycycle() ' deletes the varible contents, free some memory
End Sub
I get a Run-time error 9 on the below code.
if I replace x variable to a fix number in the line Cells(col, cy + 7) = Mycycle(x) to Cells(col, cy + 7) = Mycycle(1) it works but the cycles dont change of coarse. In the end there will be 30 to 40 cycles from a dat file with only a blank cell between the cycles
if there is a better way to do this type of array please let me know.
Thank you for any help
John
Sub findcycle()
'
'
Dim Mycycle(8) As String
Mycycle(1) = "cycle1"
Mycycle(2) = "cycle2"
Mycycle(3) = "cycle3"
Mycycle(4) = "cycle4"
Mycycle(5) = "cycle5"
Mycycle(6) = "cycle6"
Mycycle(7) = "cycle7"
Mycycle(8) = "cycle8"
Dim mycount
Dim col
Dim row
Dim cy
Dim x
mycount = 0
cy = 13
x = 1
Columns("A:A").Select
mycount = Range("A65536").End(xlUp).row
Cells(15, 17).Select
'sorts data
For col = 18 To mycount
If Cells(col, cy) <= "" Then
Cells(col, cy + 7) = Mycycle(x)
End If
If Cells(col, cy) = "" Then
If Cells(col + 8, cy) = "" Then GoTo estop
End If
x = x + 1
Next col
estop:
Erase Mycycle() ' deletes the varible contents, free some memory
End Sub