Change Macro to Find First Empty Cell

J

Jenny B.

Hello,

Is there a way to change the below code to select the first empty cell in
the row vs. the offset of the last cell entry? I have a workbook with empty
spaces in this column and I would like to fill in those spaces vs. dropping
to the end of the last column entry.

Thanks for your review –

Roger



Sub FrontPage()

Dim irow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")

irow = ws.Cells(Rows.Count, 12) _
.End(xlUp).Offset(1, 0).Row

ws.Cells(irow, 12) = ActiveSheet.Range("h5").Value

End Sub
 
C

carlo

You could do:

Sub FrontPage()


Dim irow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")

irow = ws.Cells(1, 12) _
.End(xlDown).Offset(1, 0).Row

ws.Cells(irow, 12) = ActiveSheet.Range("h5").Value

End Sub

hth

Carlo
 
J

JMB

you could try:

ws.Columns(12).SpecialCells(xlCellTypeBlanks).Cells(1) =
ActiveSheet.Range("h5").Value
 
J

Jenny B.

Thank you very much.

Works Great.

carlo said:
You could do:

Sub FrontPage()


Dim irow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")

irow = ws.Cells(1, 12) _
.End(xlDown).Offset(1, 0).Row

ws.Cells(irow, 12) = ActiveSheet.Range("h5").Value

End Sub

hth

Carlo
 

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

Top