Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Active cell position for macro

I am running a macro to add rows or remove rows assigned to a form button.
The problem is if the active cell is moved from the last blank row the marco
won't run.

Is it possible to have the macro alway return the cursor to the required
active cell before it runs?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,345
Default Active cell position for macro

May have been better if you had posed some of yout code but try something
like:

ActiveCell.End(xlUp).Offset(1, 0).Select

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"MechEng" wrote in message
...
I am running a macro to add rows or remove rows assigned to a form button.
The problem is if the active cell is moved from the last blank row the
marco
won't run.

Is it possible to have the macro alway return the cursor to the required
active cell before it runs?



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Active cell position for macro

Without seeing your code it is hard to say why your macro won't run if
activecell is not in last blank row.

This will move the cursor to last blank cell in column A

Sub foo()
Dim rcell As Range
Set rcell = ActiveSheet.Cells(Rows.Count, 1).End(xlUp) _
.Offset(1, 0)
Application.Goto Reference:=rcell
MsgBox "Activecell is" & rcell.Address
End Sub


Gord Dibben MS Excel MVP

On Sat, 22 Sep 2007 12:36:00 -0700, MechEng
wrote:

I am running a macro to add rows or remove rows assigned to a form button.
The problem is if the active cell is moved from the last blank row the marco
won't run.

Is it possible to have the macro alway return the cursor to the required
active cell before it runs?


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Active cell position for macro

Thank you both. It is working great now.
I appreciate the help.

Dan

"Gord Dibben" wrote:

Without seeing your code it is hard to say why your macro won't run if
activecell is not in last blank row.

This will move the cursor to last blank cell in column A

Sub foo()
Dim rcell As Range
Set rcell = ActiveSheet.Cells(Rows.Count, 1).End(xlUp) _
.Offset(1, 0)
Application.Goto Reference:=rcell
MsgBox "Activecell is" & rcell.Address
End Sub


Gord Dibben MS Excel MVP

On Sat, 22 Sep 2007 12:36:00 -0700, MechEng
wrote:

I am running a macro to add rows or remove rows assigned to a form button.
The problem is if the active cell is moved from the last blank row the marco
won't run.

Is it possible to have the macro alway return the cursor to the required
active cell before it runs?



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
how to create a macro that references the currently active cell Kurt Excel Worksheet Functions 2 December 13th 06 05:49 PM
macro- move down to empty cell & active worksheet EducatingMom Excel Worksheet Functions 3 August 4th 06 11:02 PM
Update Macro: Leave Colour As Before Once Cell is Not Active JB2010 Excel Discussion (Misc queries) 2 February 2nd 06 06:08 PM
keep active sheet view and cursor position killa47 Excel Worksheet Functions 0 November 8th 05 09:20 AM
Relative Cell position NOT working with or without macro Scratching my Head Excel Discussion (Misc queries) 6 May 30th 05 06:12 PM


All times are GMT +1. The time now is 11:09 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"