ukyank
12-17-2009, 07:40 AM
I create dthis based upon someone else's script on here and I keep getting a compile error. Was hoping someone might point me in the right direction as to what I am doing wrong. Cheers in advance
Sub CopyDates()
Dim AttendSheets As Variant, ggetDates As Worksheet
Dim attRow As Integer, attCol As Integer, ggetRow As Integer, ggetCol As Integer, n As Long
AttendSheet = Array("Sheet1", "Sheet2", "Sheet3")
Set ggetDates = Sheets("Data")
ggetRow = 2
ggetCol = 1
attRow = 2 'WILL REMAIN CONSTANT
attCol = 5
Application.ScreenUpdating = False 'Stop intermitten updates
For n = LBound(AttendSheet) To UBound(AttendSheet)
With AttendSheet(n)
'Column
Do While Not (IsEmpty(Cells(ggetRow, ggetCol)))
'Row
Do While Not (IsEmpty(Cells(ggetRow, ggetCol)))
Cells(attRow, attCol) = ggetDates.Cells(ggetRow, ggetCol)
ggetRow = ggetRow + 1
attCol = attCol + 1
Loop
ggetCol = ggetCol + 1
Loop
EndWith
Next n
Application.ScreenUpdating = True 'Restart update viewing
End Sub
Sub CopyDates()
Dim AttendSheets As Variant, ggetDates As Worksheet
Dim attRow As Integer, attCol As Integer, ggetRow As Integer, ggetCol As Integer, n As Long
AttendSheet = Array("Sheet1", "Sheet2", "Sheet3")
Set ggetDates = Sheets("Data")
ggetRow = 2
ggetCol = 1
attRow = 2 'WILL REMAIN CONSTANT
attCol = 5
Application.ScreenUpdating = False 'Stop intermitten updates
For n = LBound(AttendSheet) To UBound(AttendSheet)
With AttendSheet(n)
'Column
Do While Not (IsEmpty(Cells(ggetRow, ggetCol)))
'Row
Do While Not (IsEmpty(Cells(ggetRow, ggetCol)))
Cells(attRow, attCol) = ggetDates.Cells(ggetRow, ggetCol)
ggetRow = ggetRow + 1
attCol = attCol + 1
Loop
ggetCol = ggetCol + 1
Loop
EndWith
Next n
Application.ScreenUpdating = True 'Restart update viewing
End Sub