View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Cell value that changes previously entered value

Sorry.., I wasn't aware of your skills level. Yes, the code does not
work "as is" and so here is a complete macro that you can paste into a
standard module. To do this, open the VBE (Alt+F11) and right-click
your project (workbook name listed in the Project Explorer pane) and
select InsertModule from the context menu. Then paste this sub into
the code window that appears...

Sub RejectAdjacentData()
Dim c As Range, sz As String, lRow As Long

For Each c in Range("B1:B4")
sz = c.Text: lRow = c.Row
c.Formula = _
"=IF($A" & lRow & "=""NO""," & sz & " rejected," & sz & ")"
Next 'c
End Sub

Thanks for catching the missing quotes!
To use the macro enter Alt+F8 on the keyboard and select the macro in
the list, then click 'Run' to execute.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion