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

  • Thread starter Thread starter Randy Reese
  • Start date Start date
R

Randy Reese

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.
 
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
 
This puts a's all the way to row 500. My test data goes to row 171.
 
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
 
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
 
Thanks Tony, works great.
acw said:
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
 

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