+ Reply to Thread
Results 1 to 6 of 6

Restrict VBA execution to a range o cells!

  1. #1
    Registered User
    Join Date
    06-29-2016
    Location
    Ireland
    MS-Off Ver
    2019
    Posts
    47

    Restrict VBA execution to a range o cells!

    Good afternoon, folks!

    I have a very simple code for copying formulae and formatting of the entire row where the cell is selected, adding a row below it and pasting it.
    I call it through a button placed on the worksheet.
    The thing is, I want it to work only when a cell within a certain range is selected (C28:I32).
    If the selected cell is outside this range and I call the macro, I needed a Msg Box with something like "Not allowed".
    Could you please give me hand?

    Regards,

    Ricardo

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Restrict VBA execution to a range o cells!

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Restrict VBA execution to a range o cells!

    Does this work?

    Please Login or Register  to view this content.
    Source: http://www.mrexcel.com/forum/excel-q...lications.html
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Registered User
    Join Date
    06-29-2016
    Location
    Ireland
    MS-Off Ver
    2019
    Posts
    47

    Re: Restrict VBA execution to a range o cells!

    Hi, Kenneth!

    Wow, fairly quick answer!
    I tried that but what is it doing is the other way round of what I need.
    Your is restricting the range C28:I32 and leaving the rest ok. I needed to allow the macro in the C28:I32 and stop all the rest.

    Regards,

  5. #5
    Registered User
    Join Date
    06-29-2016
    Location
    Ireland
    MS-Off Ver
    2019
    Posts
    47

    Re: Restrict VBA execution to a range o cells!

    Special K,

    Thank for your quick answer. I modified your code and it works wonderfully.

    HTML Code: 
    Thanks a million!

  6. #6
    Registered User
    Join Date
    06-29-2016
    Location
    Ireland
    MS-Off Ver
    2019
    Posts
    47

    Re: Restrict VBA execution to a range o cells!

    Moved to another post.
    Last edited by Hellion; 11-25-2016 at 12:30 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. Restrict Deleting a Range
    By plans in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-03-2015, 04:12 PM
  2. Restrict a copy/paste range that is already restricted
    By gaker10 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-03-2014, 10:05 AM
  3. How do you restrict the range of a search
    By SolihullRog in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-01-2012, 01:57 AM
  4. Replies: 5
    Last Post: 07-03-2012, 12:08 PM
  5. VBA Shift Rows Within Range - Execution Speed
    By eadamy in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-22-2011, 06:28 PM
  6. Adjustable Rate Mortgage Restrict Range
    By schoolboy in forum Excel General
    Replies: 2
    Last Post: 04-14-2008, 11:47 PM
  7. [SOLVED] How to restrict the TitleRow only for a specific range of rows?
    By Oscar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-05-2005, 08:06 PM

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