+ Reply to Thread
Results 1 to 5 of 5

Selecting range of cells whilst 'event selection procedure' runs in the background

  1. #1
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Waterbury, CT
    MS-Off Ver
    Office 365
    Posts
    1,175

    Selecting range of cells whilst 'event selection procedure' runs in the background

    Hi.
    I'm having some trouble with target cells in event procedure, when i select any range of more than two cells (for cell formatting purposes) the debugger goes on but not sure why?
    Here is my code:
    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Waterbury, CT
    MS-Off Ver
    Office 365
    Posts
    1,175

    Re: Selecting range of cells whilst 'event selection procedure' runs in the background

    I added this and it works now
    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Selecting range of cells whilst 'event selection procedure' runs in the background

    Hi,

    Your problem was caused by Target.Row and Target.Column and Target.Value being illegal when more than one cell was selected.

    If you limit selection to one cell only try the following:
    Please Login or Register  to view this content.
    Please NOTE: When using Excel 2003 replace CountLarge with Count, because CountLarge is NOT available in Excel 2003.



    If selecting more than one cell is allowed try:
    Please Login or Register  to view this content.
    Lewis

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Selecting range of cells whilst 'event selection procedure' runs in the background

    Your solution in post #2 still causes a runtime error for me, when selecting more than one cell.

  5. #5
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Waterbury, CT
    MS-Off Ver
    Office 365
    Posts
    1,175

    Re: Selecting range of cells whilst 'event selection procedure' runs in the background

    Dear Lewis,
    I actually did want to have the option of selecting more than one cell but i thought that would be impossible so i inserted in my code the exit sub if i selected anything outside the range mentioned in the code. It did not take care of the issue if i selected more than one cell within the range mentioned in the code, but once again, i thought there was no way out.
    The second code you posted is originally what i was looking for and it works flawlessly! Thank you.

    P.S. sometimes i think it would be impossible to get a solution to certain vba questions i have but then i am proven wrong.
    You inspire me

    Thank you.

+ 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. Executing a bouncing sheep whilst the code/macro runs
    By mike_vr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-03-2013, 08:21 AM
  2. [SOLVED] Pause macro whilst selecting the file i want to copy from
    By stevekirk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-03-2012, 09:07 PM
  3. VBA for selecting a range to fill a selection
    By mbesspiata in forum Excel General
    Replies: 1
    Last Post: 07-30-2012, 01:15 PM
  4. Selecting range using .range. But can you do same selection using .columns
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-01-2011, 01:31 PM
  5. Pause macro procedure whilst Query runs
    By johncassell in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-19-2010, 01:30 PM
  6. [SOLVED] Runs in macro but not in procedure...why?
    By Billy B in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2006, 12:30 AM
  7. Macro that runs in the background
    By tomwashere2 in forum Excel General
    Replies: 0
    Last Post: 10-22-2005, 06:05 PM
  8. Replies: 4
    Last Post: 02-10-2005, 03: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