B
brownti via OfficeKB.com
I am using the below code and it works perfectly except for one thing. If
there is a blank in the range "cost", but there is a value in the offset
column, it will clear that value out. I want the code to ignore blank cells
in the range. I tried a couple different things to no avail. Please advise.
Thanks.
Sub hardpunch()
Dim msg1, style1, title1, response1
msg1 = "Are you sure you want to hardpunch all prices?"
style1 = vbOK + vbCritical
title1 = "Hardpunch..."
response1 = MsgBox(msg1, style1, title1)
If response1 = vbOK Then
For Each cell In Range("cost")
If cell.Interior.ColorIndex = 3 Then
If IsNumeric(cell.Value) Then
cell.Offset(0, 1).Value = cell.Value
End If
End If
If cell.Interior.ColorIndex = 55 Then
If IsNumeric(cell.Value) Then
cell.Offset(0, 1).Value = cell.Value
End If
End If
Next
Else
Exit Sub
End If
End Sub
there is a blank in the range "cost", but there is a value in the offset
column, it will clear that value out. I want the code to ignore blank cells
in the range. I tried a couple different things to no avail. Please advise.
Thanks.
Sub hardpunch()
Dim msg1, style1, title1, response1
msg1 = "Are you sure you want to hardpunch all prices?"
style1 = vbOK + vbCritical
title1 = "Hardpunch..."
response1 = MsgBox(msg1, style1, title1)
If response1 = vbOK Then
For Each cell In Range("cost")
If cell.Interior.ColorIndex = 3 Then
If IsNumeric(cell.Value) Then
cell.Offset(0, 1).Value = cell.Value
End If
End If
If cell.Interior.ColorIndex = 55 Then
If IsNumeric(cell.Value) Then
cell.Offset(0, 1).Value = cell.Value
End If
End If
Next
Else
Exit Sub
End If
End Sub