Macro Help

  • Thread starter Thread starter Kell2604
  • Start date Start date
K

Kell2604

I am trying to run a macro which will navigate to the first empty cell in my
workbook. This cell is always changing. The macro I'm running below always
ends up in cell A31 regardless of what my empty cell is (today it's A377).
Can anyone help?

Thanks very much!!

Windows("Daily OTD December 2008_kcs.xls").Activate
Dim LastRow As Long
LastRow = ActiveWorkbook.Worksheets(1) _
.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Range("A" & LastRow).Select
 
Are you on the first worksheet, or are you on the active sheet?

If you want to find the first empty cell of column A of the currently active sheet of the workbook
Daily OTD..., then use

Windows("Daily OTD December 2008_kcs.xls").Activate
Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Select


HTH,
Bernie
MS Excel MVP
 

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