Hi All,
I have the below code working but not doing everything that I expect. It counts the number of columns on one sheet and copies the headings to rows to another sheet. One thing is that sometimes there are more than 10 headings and there are only room for 10 rows. So after 10 I need to insert rows. Currently the below code counts and inserts rows correctly but for some strange reason it only copies headings to rows for the first 9. What am I missing here?
Thanks,
~RUTH~
Sub test()
Dim NumCol As Long
Sheets("TREAT data").Select
NumCol = ActiveSheet.Cells(71, 256).End(xlToLeft).Column - 1 'counts number of measures
Sheets("Detailed Measures").Select
For i = 0 To NumCol 'cycle through all the columns of measures
If i >= 10 Then
Rows("15:15").Select 'measure #10
Selection.Insert Shift:=xlDown 'insert a row before measure #10
End If
Sheets("Detailed Measures").Range("B6").Offset(i, 0).Value = Sheets("TREAT data").Range("B71").Offset(0, i).Value
Next i
End Sub
Bookmarks