ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro - cell content left then.... (https://www.excelbanter.com/excel-programming/395247-macro-cell-content-left-then.html)

Paul Dennis

Macro - cell content left then....
 
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

Tom Ogilvy

Macro - cell content left then....
 
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

--
regards,
Tom Ogilvy

"Paul Dennis" wrote:

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


Keith74

Macro - cell content left then....
 
Will a worksheet function do?

=IF(z1<"",IF(A1<"","Yes",""),"")

Keith


PCLIVE

Macro - cell content left then....
 
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

--

"Paul Dennis" wrote in message
...
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





All times are GMT +1. The time now is 06:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com