Macro - cell content left then....

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to build a macro that will look for any value in each cell in
column Z and then to put a Yes in cell AA.

This needs to work for all cells in column Z were there is any data in the
cell in column A.

He
 
sub UpdateAA()
Dim r as Range, r1 as Range, c as Range
On error Resume Next
set r = columns("Z").specialCells(xlConstants)
set r1 = columns("Z").SpecialCells(xlFormulas)
On Error goto 0
if not r is nothing then
for each c in r
c.offset(0,1).Value = "Yes"
Next
end if
if not r1 is nothing then
for each c in r1
c.offset(0,1).Value = "Yes"
Next
end if
end Sub
 
One possible way:

For Each cell In Range("Z1:Z100")
If cell.Value = "Value" _
Then
cell.Offset(0, 1).Value = "Yes"
Else
End If
Next cell



Adjust your range and "Value" as necessary. If you want your "Value" to be
a cell, then:
If cell.Value = Range("A1").value

Hope this helps,
Paul
 

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

Back
Top