View Single Post
  #5   Report Post  
rtour957 rtour957 is offline
Junior Member
 
Posts: 16
Default

Quote:
Originally Posted by GS[_2_] View Post
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
I pasted the macro into the VBE but putting "no" to any of the cells in A does not add the string "rejected" to the existing value in B. I attached the file I had the macro in. Would be able to check why it's not working?

Thank you for your patience,
Art
Attached Files
File Type: zip F1 rej.zip (8.9 KB, 40 views)