+ Reply to Thread
Results 1 to 3 of 3

how to check if user has made a selection on the sheet

  1. #1
    Registered User
    Join Date
    12-23-2004
    Posts
    7

    how to check if user has made a selection on the sheet

    hi all,
    I think its pretty simple but i'm just missing it. Can someone tell me how to check if the user has made a selection or selections on the excel sheet. I want that user selects one or more cells and then clicks a button in the menu bar to change the color of selected cell(s).
    thanx in advance for help.
    amit

  2. #2
    Registered User
    Join Date
    11-14-2004
    Location
    Georgia
    Posts
    57
    well, without checking, it would be simple.

    ActiveCell.(action here)

    but considering it's not possible to NOT have an activecell at any given time, you should have a string that checks if it is in a certain boundry. and i haven't encountered a use for that, so you'll have to look elsewhere.
    Brought to you by Pringles and his infinite genius. ~''~

    "Ctrl+Z is a beautiful thing."
    - Me.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Quote Originally Posted by chawla12amit
    hi all,
    I think its pretty simple but i'm just missing it. Can someone tell me how to check if the user has made a selection or selections on the excel sheet. I want that user selects one or more cells and then clicks a button in the menu bar to change the color of selected cell(s).
    thanx in advance for help.
    amit

    Hello Chawla,

    You can tell by using the following Worksheet Event :
    Worksheet_SelectionChange(ByVal Target As Excel.Range)

    Target will be the cell or group of cells the user has chosen. You can at this point change the color (no button needed). You can select which cells will be changed by testing with an If statement:

    If Target.Address = "$A$1" Then Target.Interior.ColorIndex = 2 'Red

    Each Worksheet in the Workbook has this Event.

    Hope this Helps,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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