Inserting Formula moving down each row

I

iashorty

Put formula into col. S as long as same row in col J has something in it.

Range("S2").Select
x = ActiveCell.Row
Do While Cells(x, 10).Value <> ""
ActiveCell.FormulaR1C1 = _
"=IF(RC[-9]=""EVT2"",1,IF(RC[-9]=""EVT3"",2,9))"
x = x + 1
Loop

End Sub

Why doesn't this move to the next row?
 
N

Nick Hodge

You are not moving anything, the activecell is not changing (not that it
needs to)

Range("S2").Select
x = ActiveCell.Row
Do While Cells(x, 10).Value <> ""
cells(x,19).FormulaR1C1 = _
"=IF(RC[-9]=""EVT2"",1,IF(RC[-9]=""EVT3"",2,9))"
x = x + 1
Loop

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
web: www.excelusergroup.org
web: www.nickhodge.co.uk
 
J

JP

You are only incrementing the cell being checked, not the selected
cell.

Cells(2,10).Value
Cells(3,10).Value
Cells(4,10).Value

etc

HTH,
JP
 

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