M
Mark
I am using Excel 97 and struggling to get the following
loop to work properly.
Can anyone assist me with where I am going wrong?
I want to pickup dates from one sheet and copy them also
as dates into another sheet but for some reason it
recognises that there is something in the cell but doesn't
pickup it's value!!
I have defined
StartDate & LastDate as Date
TotalDays as integer
Holiday as string
THE CODE
..............................................
Let A = 7
Let B = 7
Let C = 7
Let D = 7
' search for all sheets and get values
For Each asheet In ActiveWorkbook.Sheets
If asheet.Visible = True Then
sheetname = asheet.Name
Worksheets(sheetname).Activate
With ActiveSheet
EmployeeName = Cells(4, 1).Value
OfficeName = Cells(2, 2).Value
DeptName = Cells(2, 5).Value
FloorNo = Cells(3, 3).Value
DaysAvailable = Cells(31, 9).Value
If strOffice = "ALL" Then GoTo All
If OfficeName <> strOffice Then GoTo Continue
All:
Do Until IsEmpty(asheet.Cells(A, 2))
StartDate = Cells(A, 2).Value
LastDate = Cells(B, 3).Value
TotalDays = Cells(C, 10).Value
HolDetails = Cells(D, 1).Value
' SUB TO MOVE VALUES TO LEAVE TABLE
DoMoveToLeaveTableDates
Let A = A + 1
Let B = B + 1
Let C = C + 1
Let D = D + 1
Loop
End With
Continue:
End If
Let A = 7
Let B = 7
Let C = 7
Let D = 7
Next asheet
....................................................
Mark
loop to work properly.
Can anyone assist me with where I am going wrong?
I want to pickup dates from one sheet and copy them also
as dates into another sheet but for some reason it
recognises that there is something in the cell but doesn't
pickup it's value!!
I have defined
StartDate & LastDate as Date
TotalDays as integer
Holiday as string
THE CODE
..............................................
Let A = 7
Let B = 7
Let C = 7
Let D = 7
' search for all sheets and get values
For Each asheet In ActiveWorkbook.Sheets
If asheet.Visible = True Then
sheetname = asheet.Name
Worksheets(sheetname).Activate
With ActiveSheet
EmployeeName = Cells(4, 1).Value
OfficeName = Cells(2, 2).Value
DeptName = Cells(2, 5).Value
FloorNo = Cells(3, 3).Value
DaysAvailable = Cells(31, 9).Value
If strOffice = "ALL" Then GoTo All
If OfficeName <> strOffice Then GoTo Continue
All:
Do Until IsEmpty(asheet.Cells(A, 2))
StartDate = Cells(A, 2).Value
LastDate = Cells(B, 3).Value
TotalDays = Cells(C, 10).Value
HolDetails = Cells(D, 1).Value
' SUB TO MOVE VALUES TO LEAVE TABLE
DoMoveToLeaveTableDates
Let A = A + 1
Let B = B + 1
Let C = C + 1
Let D = D + 1
Loop
End With
Continue:
End If
Let A = 7
Let B = 7
Let C = 7
Let D = 7
Next asheet
....................................................
Mark