Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading Across a Row for a Value

Status
Not open for further replies.

tudor30

Technical User
Jan 7, 2004
49
US
I would like to read from C4 to L4 and verify if any of those cells has a value in it. If so, Then copy the value of B4 to AB4.

If ActiveSheet.Range("C4") <> "" Then
ActiveSheet.Range("AB4") = ActiveSheet.Range("B4")
ElseIf ActiveSheet.Range("C4") = "" Then
ActiveSheet.Range("AB4") = ""
End If

Thanks for suggestions,
John
 
Why not just put this formula in cell AB4?
Code:
=IF(COUNTA(C4:L4)>0,B4,"")
 
Something like this ?
bFound = False
For r = 3 To 12
If ActiveSheet.Cells(r, 4).Value <> "" Then
bFound = True
Exit For
End If
Next
If bFound Then
ActiveSheet.Range("AB4") = ActiveSheet.Range("B4")
Else
ActiveSheet.Range("AB4") = ""
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top