willyboy58
Technical User
The brief worksheet looks like:
A B C D E F
1 name job 05-01-03 5-02-03
2 Bob 186 6.0 6.0
3 Steve 188 6.0
4 Mike 189 6.0
Row 1 is my headings: 2 on down is the employee name, job # and hours. Columns D and F are the empty cells to place an L and H into.
In the procedure below, if the value in the activecell in column B is equal to 186 or 189 then I want an “L” in the empty column next to the hours in the row for that day (Bob column D; Mike column F). Each row may have more than one entry of hours. If it is 188, then I want an “H” (Steve column D). But I keep getting the error of “Loop without a Do”. Why? I do have a Do. Any help will be greatly appreciated. TIA. Bill
'this sub is to insert the H and P into the column next to the
' TOTAL hours
Sub InsertH_And_PTotalRowCells()
Dim LeaveHours As TextEffectFormat
Dim HolidayHours As TextEffectFormat
LeaveHours = "L"
HolidayHours = "H"
Range("A2"
.Select
Do
With ActiveCell
If ActiveCell = "" Then
ActiveCell = ActiveCell.Offset(0, 1)
Else
If ActiveCell <> "" Then
ActiveCell.Offset(1, 1).Select
If ActiveCell = 186 Or 189 Then
While Not IsEmpty(ActiveCell)
With ActiveCell()
ActiveCell.Offset(0, 1).Select
ActiveCell = LeaveHours
ActiveCell.Offset(0, 1).Select
End With
Wend
Else
If ActiveCell = 188 Then
While Not IsEmpty(ActiveCell)
With ActiveCell()
ActiveCell.Offset(0, 1).Select
ActiveCell = HolidayHours
ActiveCell.Offset(0, 1).Select
End With
Wend
End If
End If
End If
End If
Loop Until ActiveCell.Formula = 'NOTE: I know I need something here. I have used different cell values but the message is still the same.
End Sub
A B C D E F
1 name job 05-01-03 5-02-03
2 Bob 186 6.0 6.0
3 Steve 188 6.0
4 Mike 189 6.0
Row 1 is my headings: 2 on down is the employee name, job # and hours. Columns D and F are the empty cells to place an L and H into.
In the procedure below, if the value in the activecell in column B is equal to 186 or 189 then I want an “L” in the empty column next to the hours in the row for that day (Bob column D; Mike column F). Each row may have more than one entry of hours. If it is 188, then I want an “H” (Steve column D). But I keep getting the error of “Loop without a Do”. Why? I do have a Do. Any help will be greatly appreciated. TIA. Bill
'this sub is to insert the H and P into the column next to the
' TOTAL hours
Sub InsertH_And_PTotalRowCells()
Dim LeaveHours As TextEffectFormat
Dim HolidayHours As TextEffectFormat
LeaveHours = "L"
HolidayHours = "H"
Range("A2"
Do
With ActiveCell
If ActiveCell = "" Then
ActiveCell = ActiveCell.Offset(0, 1)
Else
If ActiveCell <> "" Then
ActiveCell.Offset(1, 1).Select
If ActiveCell = 186 Or 189 Then
While Not IsEmpty(ActiveCell)
With ActiveCell()
ActiveCell.Offset(0, 1).Select
ActiveCell = LeaveHours
ActiveCell.Offset(0, 1).Select
End With
Wend
Else
If ActiveCell = 188 Then
While Not IsEmpty(ActiveCell)
With ActiveCell()
ActiveCell.Offset(0, 1).Select
ActiveCell = HolidayHours
ActiveCell.Offset(0, 1).Select
End With
Wend
End If
End If
End If
End If
Loop Until ActiveCell.Formula = 'NOTE: I know I need something here. I have used different cell values but the message is still the same.
End Sub