Help ammendin some code

  • Thread starter Thread starter ordnance1
  • Start date Start date
O

ordnance1

Someone in the Worksheet Functions Group was good enough to provide me with
the code below. Is the any was to ammend that so the c.Value "NOT CALLED" is
only wriien to that row if cell in column A is greater 5?


Sub test()

Dim MyRange As Range
Dim c As Range

Set MyRange = ActiveSheet.Range("h1:h500")

For Each c In MyRange
If c.Value = "" Then
c.Value = "NOT CALLED"
End If
Next c

End Sub
 
Hi

This should do it:

Sub test()

Dim MyRange As Range
Dim c As Range

Set MyRange = ActiveSheet.Range("h1:h500")
For Each c In MyRange
If c.Value = "" Then
If c.Offset(0, -7) > 5 Then
c.Value = "NOT CALLED"
End If
End If
Next c
End Sub

Regards,
Per
 
If c.Value = "" and c.entirerow.cells(1).value > 5 Then
c.Value = "NOT CALLED"
End If

....assuming all values in ColA are going to be numeric.

Tim
 
Try the below

Sub test()

Dim MyRange As Range
Dim c As Range

Set MyRange = ActiveSheet.Range("h1:h500")

For Each c In MyRange
If c.Value = "" And Range("A" & c.Row).Value > 5 Then
c.Value = "NOT CALLED"
End If
Next c

End Sub

If this post helps click Yes
 
Back
Top