Help ammendin some code

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
 
P

Per Jessen

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
 
T

Tim Williams

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
 
J

Jacob Skaria

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top