Macro for cells that are less than 1 and conditioned on another ce

F

frenchdaddy

Trying to write a macro that takes a range of cells (J45:J2546) and checks to
see if any of the cells in this range are less than 1. But it needs to
verify that there is number greater than 1 in column A of the same row.
Then I need it to insert the number 1,000 into that cell.

Something sort of like .... IF J45<1 AND A>1, then insert 1,000.

If anyone has suggestions, Thanks!!!!
 
G

Gary''s Student

Sub dural()
Dim r As Range
Set r = Range("J45:J2546")
For Each rr In r
If rr.Value < 1 And rr.Offset(0, -9).Value > 1 Then
rr.Value = 1000
End If
Next
End Sub
 

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