P
Patti
I am trying to populate cells in columns with numeric values based on the
contents of another cell. In the following sub, the values are stored as
shown by debug.print, but they are not written to my sheet. Can anyone tell
my why, please?
Thanks in advance,
Patti
Dim myRange As Range, rCell As Range
With Worksheets("Employees")
Set myRange = .Range(.Cells(2, 3), .Cells(2, 3).End(xlDown))
For Each rCell In myRange.Cells
If rCell.Offset(0, 3).Value = "PT" Then
rCell.Offset(0, 8).Value = 200
rCell.Offset(0, 9).Value = 250
ElseIf rCell.Offset(0, 3).Value = "FT" Then
rCell.Offset(0, 8).Value = 300
rCell.Offset(0, 9).Value = 350
ElseIf rCell.Offset(0, 3).Value = "Other" Then
rCell.Offset(0, 8).Value = 400
rCell.Offset(0, 9).Value = 450
Else
End If
Debug.Print "row" & rCell & rCell.Address
Debug.Print rCell.Offset(0, 3).Value
Debug.Print rCell.Offset(0, 8).Value
Debug.Print rCell.Offset(0, 9).Value
Next
End With
End Sub
contents of another cell. In the following sub, the values are stored as
shown by debug.print, but they are not written to my sheet. Can anyone tell
my why, please?
Thanks in advance,
Patti
Dim myRange As Range, rCell As Range
With Worksheets("Employees")
Set myRange = .Range(.Cells(2, 3), .Cells(2, 3).End(xlDown))
For Each rCell In myRange.Cells
If rCell.Offset(0, 3).Value = "PT" Then
rCell.Offset(0, 8).Value = 200
rCell.Offset(0, 9).Value = 250
ElseIf rCell.Offset(0, 3).Value = "FT" Then
rCell.Offset(0, 8).Value = 300
rCell.Offset(0, 9).Value = 350
ElseIf rCell.Offset(0, 3).Value = "Other" Then
rCell.Offset(0, 8).Value = 400
rCell.Offset(0, 9).Value = 450
Else
End If
Debug.Print "row" & rCell & rCell.Address
Debug.Print rCell.Offset(0, 3).Value
Debug.Print rCell.Offset(0, 8).Value
Debug.Print rCell.Offset(0, 9).Value
Next
End With
End Sub