+ Reply to Thread
Results 1 to 2 of 2

Worksheet Selection change

  1. #1
    Forum Contributor
    Join Date
    10-06-2015
    Location
    Leeds, England
    MS-Off Ver
    365 Version 2302 Build 16.0.16130.20942
    Posts
    130

    Worksheet Selection change

    I have set up a calendar spreadsheet from a template found in Excel, but instead of having multiple sheets for the months of the year I have made an interactive calendar on just one sheet. I have written code for the Worksheet_SelectionChange in the range of cells that the calendar dates appear in so when a day is selected it will populate cells with values and format the selected day with border styles and colours, and it works just great and has become a very useful tool for my day-to-day schedule.

    However, one issue I am having is if I accidently select a range of cells over these calendar days, instead of just selecting one day, then the code fails and I receive an error. Is there a way of running the code Worksheet_SelectionChange for when just a single cell is selected in the target range, and to exit the sub if more than one cell in the range is selected?

    Thanks

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Worksheet Selection change

    First executable line in the event handler...

    Please Login or Register  to view this content.
    Also, learn how to code to handle errors ...
    Last edited by cytop; 07-12-2017 at 07:33 AM.

+ 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] Worksheet Selection Change - Hide Rows
    By sl729 in forum Excel General
    Replies: 2
    Last Post: 07-20-2016, 10:45 AM
  2. How to Combine two Different Selection Change Events on One Worksheet
    By GSU1972 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-23-2016, 09:27 AM
  3. [SOLVED] Worksheet Selection change for many cells
    By Jamesera27 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-02-2015, 06:42 PM
  4. [SOLVED] Need to have 2 worksheet selection.change rules in 1 worksheet
    By winwall in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-14-2014, 04:46 PM
  5. [SOLVED] WorkSheet Selection Change and Vlookup
    By coreytroy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-29-2013, 09:55 PM
  6. Worksheet selection change
    By sigfreid in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-22-2011, 06:16 AM
  7. Worksheet Selection Change event not firing??
    By Simon Lloyd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-21-2006, 10:29 AM

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