+ Reply to Thread
Results 1 to 7 of 7

How to make vba to wait until I select another cell

  1. #1
    Registered User
    Join Date
    10-19-2010
    Location
    Chennai, Tamilnadu
    MS-Off Ver
    Excel 2003
    Posts
    15

    How to make vba to wait until I select another cell

    Hi all,

    I have a simple code as below for colouring the precedent cells of the active cell.

    Please Login or Register  to view this content.
    This code works for a single cell, but I want to repeat this code for every cell i am selecting using arrow keys

    I thought I can do this using Wait command, but I couldnt


    Any help is highly appreciated

    thanks in advance

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: How to make vba to wait until I select another cell

    Hi, tamilvendhan,

    for a continuous selection:
    Please Login or Register  to view this content.
    For multiple areas in the selection:
    Please Login or Register  to view this content.
    Or use the Worksheet_SelectionChange-event behind the worksheet to start the code.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    10-19-2010
    Location
    Chennai, Tamilnadu
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: How to make vba to wait until I select another cell

    Thanks for your fast reply.

    But i think I have explained my need clearly.

    Tasks I want to do is as follows

    I want to check about 10 formulas stored in 10 adjacent cells
    So first I want to select a cell and run the macro.
    My code will colour the precedent cells, i will have a visual check
    Then I will move to the adjacent cell using arrow keys
    As soon as I moved to the adjacent cell, I want my code to execute automatically and colour the precedent cells
    I will have a visual check
    Then I will again move to the adjacent cell using arrow keys
    so on
    ...
    ...
    ...

    till I check all the cells with the formula

    I cant use Worksheet_SelectionChange-event because I want this code to be stored in my default excel file and use in any excel I work.


    Hope you get my need.
    Last edited by tamilvendhan; 09-27-2013 at 01:30 AM.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: How to make vba to wait until I select another cell

    Hi, tamilvendhan,

    Hope you get my need.
    Could you be kind enough to explain to me what the Worksheet_SelectionChange-event does? AFAIK it will be triggered by any change of the cursor in the sheet it monitors and could meet your requirements. Maybe you should use a cell/control to switch the event from acting to any change to just pass the action.

    I cant use Worksheet_SelectionChange-event because I want this code to be stored in my default excel file and use in any excel I work.
    Then maybe use Class programming for that part. If you donīt want that event I could only think of a macro being applied to the change of the cursor arrows (which I wonīt use) or start it manually - I canīt see a normal way in Excel VBA to suit your needs.


    Ciao,
    Holger
    Last edited by HaHoBe; 09-27-2013 at 01:37 AM. Reason: amendment after realising change of post by TO

  5. #5
    Registered User
    Join Date
    10-19-2010
    Location
    Chennai, Tamilnadu
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: How to make vba to wait until I select another cell

    AFAIK Worksheet_SelectionChange-event works only in the sheet where vba code is written. But i want to use it all excel sheets I work on. Hence i want to store a macro in my default excel file and use in all excel files i work. Correct me if i am wrong..

    Then maybe use Class programming for that part.
    Can you please tellme how to make a class programming?. because i dont know about it

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: How to make vba to wait until I select another cell

    Hi, tamilvendhan,

    to start with maybe have a look at Classes In VBA or Custom Classes and Objects.

    Ciao,
    Holger

  7. #7
    Registered User
    Join Date
    10-19-2010
    Location
    Chennai, Tamilnadu
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: How to make vba to wait until I select another cell

    and I found the best way to meet my requirement.
    I have written a macro to write a code in the selection_change event procedure of the active sheet

    Here it is

    Please Login or Register  to view this content.

+ 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. [SOLVED] Make Excel wait
    By Test123Test in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-23-2013, 01:30 PM
  2. Make macro wait for process to complete
    By pjaj in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-13-2012, 01:05 AM
  3. Make macro wait for process to complete
    By shawnh in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 02-16-2010, 07:52 PM
  4. Make Modaless form wait for 'OK' click
    By duckboy1981 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2009, 07:42 AM
  5. Make it wait
    By Rhapsodie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2009, 03:47 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