Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default If statement to stop Macro

Hi all, I have a macro which basically rearranges data ready for another
person to upload. I want to create a fail safe for it. Can I make a macro
to do, If the cursor is not in A1 field on both sheets not to run, and print
an error msg? I imagine it will be something like:

If cursor A1 on Sheet A And A1 on Sheet B
Then run macro <name
Else "print error, cursor not in A1 positions on sheet A / B" And End macro.

Thanks in advance, and any help is much appretiated

Ernest
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default If statement to stop Macro

Hi Ernest,

Why not instead write your macro to be independent of the active cell
location?

---
Regards,
Norman



"Ernest Lai" wrote in message
...
Hi all, I have a macro which basically rearranges data ready for another
person to upload. I want to create a fail safe for it. Can I make a
macro
to do, If the cursor is not in A1 field on both sheets not to run, and
print
an error msg? I imagine it will be something like:

If cursor A1 on Sheet A And A1 on Sheet B
Then run macro <name
Else "print error, cursor not in A1 positions on sheet A / B" And End
macro.

Thanks in advance, and any help is much appretiated

Ernest



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default If statement to stop Macro

Hmm ok, it works when they are both not in A1. However I have had an
instance where it missed copying the first column. I guess I could just add
into the macro to select A1 in both sheets.



"Norman Jones" wrote:

Hi Ernest,

Why not instead write your macro to be independent of the active cell
location?

---
Regards,
Norman



"Ernest Lai" wrote in message
...
Hi all, I have a macro which basically rearranges data ready for another
person to upload. I want to create a fail safe for it. Can I make a
macro
to do, If the cursor is not in A1 field on both sheets not to run, and
print
an error msg? I imagine it will be something like:

If cursor A1 on Sheet A And A1 on Sheet B
Then run macro <name
Else "print error, cursor not in A1 positions on sheet A / B" And End
macro.

Thanks in advance, and any help is much appretiated

Ernest




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
Excel Formula Formatting - How to Add a STOP Statement rhg Excel Worksheet Functions 4 August 15th 09 06:35 PM
If statement - can it stop once a conditon is reached? mike Excel Worksheet Functions 1 July 10th 09 07:56 PM
If statement to stop macro AK Excel Programming 3 June 29th 05 11:41 PM
Macro: With Stop it works. Without Stop it doesn't. Don Wiss Excel Programming 2 October 12th 04 10:49 AM
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:17 AM.

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"