Results 1 to 5 of 5

Overflow error on worksheet_selectionchange when counting selected cells

Threaded View

  1. #1
    Registered User
    Join Date
    02-21-2013
    Location
    Ontario, Canada
    MS-Off Ver
    Office 2010
    Posts
    96

    Overflow error on worksheet_selectionchange when counting selected cells

    Hi,

    What I want to do is pretty simple. I have a sheet where I have a calendar form called when the user selects a specific cell. Now this cell is merged together with 4 other cells for a total of 5 cells. I know how everyone feels about merged cells but given the way my sheet is laid out it was unavoidable. Basically it is a time entry sheet. So I have a worksheet_selectionchange event that calls the calendar when you select the cell. This code is fairly simple.

    If Selection.Count = 5 then
    If Not Intersect(Target,Range("W5")) is nothing then
    call frmcalendar.displayin(range("W5"))
    end if
    end if
    This code works as expected and will only call upon the calendar if W5 is selected. The issue I have now is that if i were to select all cells (top left corner box) I get a run-time error 6 - Overflow on the line:

    If Selection.Count = 5 then
    I have also tried using the following code:

    If target.cells.count = 5 and not intersect(Target, Range("W5")) is nothing then
    call frmcalendar.displayin(Range("W5"))
    end if
    And again i get the same error on the top line where it says target.cells.count = 5

    I have code that copies the entire sheet over by selecting the top left corner box which is why i need this fixed otherwise i wouldnt care

    Any help on this is appreciated.

    Thanks!
    Last edited by Spritz; 06-05-2014 at 04:50 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] inserting cells when conditions not met, overflow error
    By vcorby in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-13-2012, 01:10 PM
  2. Explanation of the Run-time error '6': Overflow Error
    By mgphill in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2012, 10:46 AM
  3. Want to do a while-loop but get error message: run error '6' overflow
    By danzi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2011, 01:48 PM
  4. Overflow error copying cells?
    By AussieM8 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-04-2010, 11:10 AM
  5. Worksheet_SelectionChange get shape in the selected cell
    By FaithRaven in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-11-2009, 09:56 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