#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Macro Help

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro to copy and paste values (columns)I have a macro file built C02C04 Excel Programming 2 May 2nd 08 01:51 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 08:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"