Thread: Macro Help
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Macro Help

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


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