Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / September 2007

Tip: Looking for answers? Try searching our database.

Active cell position for macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MechEng - 22 Sep 2007 20:36 GMT
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?
Sandy Mann - 22 Sep 2007 20:51 GMT
May have been better if you had posed some of yout code but try something
like:

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

Signature

HTH

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

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

>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
[quoted text clipped - 3 lines]
> Is it possible to have the macro alway return the cursor to the required
> active cell before it runs?
Gord Dibben - 22 Sep 2007 21:06 GMT
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

>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?
MechEng - 24 Sep 2007 13:44 GMT
Thank you both. It is working great now.
I appreciate the help.

Dan

> Without seeing your code it is hard to say why your macro won't run if
> activecell is not in last blank row.
[quoted text clipped - 17 lines]
> >Is it possible to have the macro alway return the cursor to the required
> >active cell before it runs?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.