ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   if column I is blank, then puts an "a" in column A. (https://www.excelbanter.com/excel-programming/293359-if-column-i-blank-then-puts-column.html)

Randy Reese

if column I is blank, then puts an "a" in column A.
 
I need code that if column I ,starting with row 2 (with unknown number of
rows) is blank, then puts an a in column A.



Tim Zych[_6_]

if column I is blank, then puts an "a" in column A.
 
Sub PutA()
Dim rng As Range, cell As Range
Set rng = Application.Intersect( _
Range("I2:I65536"), ActiveSheet.UsedRange)
If Not rng Is Nothing Then
For Each cell In rng.Cells
If Len(cell.Value) = 0 Then
Cells(cell.Row, "A").Value = "a"
End If
Next cell
End If
End Sub


"Randy Reese" wrote in message
link.net...
I need code that if column I ,starting with row 2 (with unknown number of
rows) is blank, then puts an a in column A.





Randy Reese

if column I is blank, then puts an "a" in column A.
 
This puts a's all the way to row 500. My test data goes to row 171.

"Tim Zych" wrote in message
...
Sub PutA()
Dim rng As Range, cell As Range
Set rng = Application.Intersect( _
Range("I2:I65536"), ActiveSheet.UsedRange)
If Not rng Is Nothing Then
For Each cell In rng.Cells
If Len(cell.Value) = 0 Then
Cells(cell.Row, "A").Value = "a"
End If
Next cell
End If
End Sub


"Randy Reese" wrote in message
link.net...
I need code that if column I ,starting with row 2 (with unknown number

of
rows) is blank, then puts an a in column A.







acw[_2_]

if column I is blank, then puts an "a" in column A.
 
Hi

Try
Sub aaa()
Range("i65536").End(xlUp).Select
While ActiveCell.Row 1
If IsEmpty(ActiveCell) Then Cells(ActiveCell.Row, 1) = "a"
ActiveCell.Offset(-1, 0).Select
Wend



End Sub


This will find the last entry in column I and work up from
there.

Tony
-----Original Message-----
This puts a's all the way to row 500. My test data goes

to row 171.

"Tim Zych" wrote in message
...
Sub PutA()
Dim rng As Range, cell As Range
Set rng = Application.Intersect( _
Range("I2:I65536"), ActiveSheet.UsedRange)
If Not rng Is Nothing Then
For Each cell In rng.Cells
If Len(cell.Value) = 0 Then
Cells(cell.Row, "A").Value = "a"
End If
Next cell
End If
End Sub


"Randy Reese" wrote in message
news:1uw1c.28856

...
I need code that if column I ,starting with row 2

(with unknown number
of
rows) is blank, then puts an a in column A.






.


Randy Reese

if column I is blank, then puts an "a" in column A.
 
This doesn't work if last rows are blank. Column B always has something in
it if this helps. Perhaps code to find used range can look at B, but look
for Blanks in I???

"acw" wrote in message
...
Hi

Try
Sub aaa()
Range("i65536").End(xlUp).Select
While ActiveCell.Row 1
If IsEmpty(ActiveCell) Then Cells(ActiveCell.Row, 1) = "a"
ActiveCell.Offset(-1, 0).Select
Wend



End Sub


This will find the last entry in column I and work up from
there.

Tony
-----Original Message-----
This puts a's all the way to row 500. My test data goes

to row 171.

"Tim Zych" wrote in message
...
Sub PutA()
Dim rng As Range, cell As Range
Set rng = Application.Intersect( _
Range("I2:I65536"), ActiveSheet.UsedRange)
If Not rng Is Nothing Then
For Each cell In rng.Cells
If Len(cell.Value) = 0 Then
Cells(cell.Row, "A").Value = "a"
End If
Next cell
End If
End Sub


"Randy Reese" wrote in message
news:1uw1c.28856

...
I need code that if column I ,starting with row 2

(with unknown number
of
rows) is blank, then puts an a in column A.






.




acw[_2_]

if column I is blank, then puts an "a" in column A.
 
Hi

Ok revised using column B

Sub aaa()
Range("B65536").End(xlUp).Select
While ActiveCell.Row 1
If IsEmpty(ActiveCell.offset(0,7)) Then Cells
(ActiveCell.Row, 1) = "a"
ActiveCell.Offset(-1, 0).Select
Wend
End Sub

Tony
-----Original Message-----
This doesn't work if last rows are blank. Column B always

has something in
it if this helps. Perhaps code to find used range can

look at B, but look
for Blanks in I???

"acw" wrote in

message
...
Hi

Try
Sub aaa()
Range("i65536").End(xlUp).Select
While ActiveCell.Row 1
If IsEmpty(ActiveCell) Then Cells(ActiveCell.Row, 1)

= "a"
ActiveCell.Offset(-1, 0).Select
Wend



End Sub


This will find the last entry in column I and work up

from
there.

Tony
-----Original Message-----
This puts a's all the way to row 500. My test data goes

to row 171.

"Tim Zych" wrote in message
...
Sub PutA()
Dim rng As Range, cell As Range
Set rng = Application.Intersect( _
Range("I2:I65536"), ActiveSheet.UsedRange)
If Not rng Is Nothing Then
For Each cell In rng.Cells
If Len(cell.Value) = 0 Then
Cells(cell.Row, "A").Value = "a"
End If
Next cell
End If
End Sub


"Randy Reese" wrote in

message
news:1uw1c.28856

...
I need code that if column I ,starting with row 2

(with unknown number
of
rows) is blank, then puts an a in column A.






.



.


Randy Reese

if column I is blank, then puts an "a" in column A.
 
Thanks Tony, works great.
"acw" wrote in message
...
Hi

Ok revised using column B

Sub aaa()
Range("B65536").End(xlUp).Select
While ActiveCell.Row 1
If IsEmpty(ActiveCell.offset(0,7)) Then Cells
(ActiveCell.Row, 1) = "a"
ActiveCell.Offset(-1, 0).Select
Wend
End Sub

Tony
-----Original Message-----
This doesn't work if last rows are blank. Column B always

has something in
it if this helps. Perhaps code to find used range can

look at B, but look
for Blanks in I???

"acw" wrote in

message
...
Hi

Try
Sub aaa()
Range("i65536").End(xlUp).Select
While ActiveCell.Row 1
If IsEmpty(ActiveCell) Then Cells(ActiveCell.Row, 1)

= "a"
ActiveCell.Offset(-1, 0).Select
Wend



End Sub


This will find the last entry in column I and work up

from
there.

Tony
-----Original Message-----
This puts a's all the way to row 500. My test data goes
to row 171.

"Tim Zych" wrote in message
...
Sub PutA()
Dim rng As Range, cell As Range
Set rng = Application.Intersect( _
Range("I2:I65536"), ActiveSheet.UsedRange)
If Not rng Is Nothing Then
For Each cell In rng.Cells
If Len(cell.Value) = 0 Then
Cells(cell.Row, "A").Value = "a"
End If
Next cell
End If
End Sub


"Randy Reese" wrote in

message
news:1uw1c.28856
...
I need code that if column I ,starting with row 2
(with unknown number
of
rows) is blank, then puts an a in column A.






.



.





All times are GMT +1. The time now is 12:41 PM.

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