+ Reply to Thread
Results 1 to 3 of 3

conditional self canceling macro

  1. #1
    Registered User
    Join Date
    04-17-2015
    Location
    Branchburg, NJ
    MS-Off Ver
    windows 7
    Posts
    9

    conditional self canceling macro

    I have a macro that is assigned to a button, that when clicked, copies information from a table and places into a specific area elsewhere in my workbook. When it takes information from my table, it takes all of the information showing. The thing is, I'm supposed to filter that table down to one row of information because the area that it is supposed to paste in is only suitable for that much information. All cells around it are locked. Sooooooo....

    My problem is that I sometimes will click the button before the table is narrowed down to one row of information, which brings up my debugger/end option window. I want the macro to recognize that it cannot paste into locked cells and from there i want it to cancel itself and bring up a message saying "only one row of information can be grabbed at a time." or something.

    so to put it simply...

    click button when too much information is showing, macro realizes it cannot paste that info into locked cells, macro cancels and tells me i'm an idiot.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: conditional self canceling macro

    Hello gt4udish,

    Can you post a copy of the workbook? It will be much easier and faster to provide you with a solution if you can.

    How To Post Your Workbook
    1. At the bottom right of the Reply window, Click the button Go Advanced
    2. At the top of the Your Message Window, in the first row of icons, Click the Paperclip icon.
    3. Click the Add Files button at the top right in the dialog box. This displays the File Manager dialog.
    4. Click the Select Files button at the bottom middle of the dialog.
    5. In the new window Find the file you want to upload, select it, and Click Open.
    6. You will now be back in the File Manager dialog. Click the bottom Middle button Upload File.
    7. Wait until the file has completely uploaded before you exit the File Manager dialog.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    06-12-2015
    Location
    Maryland, USA
    MS-Off Ver
    2010
    Posts
    83

    Re: conditional self canceling macro

    If I understand your problem correctly you wish to prevent an action if a cell is currently locked.

    You can check the status of the cell by using the LOCKED property:
    Please Login or Register  to view this content.
    Replace the (1,1) for the actual coordinates of your cell.
    This works as long as you are within the worksheet of interest. Otherwise use:

    Please Login or Register  to view this content.
    See if that helps.
    Last edited by JoeFoot; 06-12-2015 at 06:59 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Canceling a Print Job
    By EdWoods in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-14-2013, 08:02 PM
  2. canceling sorting function
    By Vogelmann in forum Excel General
    Replies: 2
    Last Post: 10-24-2012, 07:49 AM
  3. Canceling out zeros
    By esupply in forum Excel General
    Replies: 5
    Last Post: 03-12-2010, 05:07 PM
  4. PRINT macro: prevent error when canceling at InputBox level
    By zusammen in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-19-2009, 07:52 AM
  5. Canceling items from a sheet
    By Skiman in forum Excel General
    Replies: 9
    Last Post: 03-02-2008, 09:12 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1