+ Reply to Thread
Results 1 to 4 of 4

Problem with Code to "Click to highlight cell"

  1. #1
    Registered User
    Join Date
    02-01-2014
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2010
    Posts
    2

    Problem with Code to "Click to highlight cell"

    Hi all

    I have a bit of code that highlights a cell when clicked (pasted below) and I have attatched to an "on/off" button. I apologize in advance for not knowing the correct terms for everything.

    This is the portion in the "sheet 1" macro window:

    Please Login or Register  to view this content.
    and this it the portion in "module 1":

    Please Login or Register  to view this content.
    so the problem is that I need to paste a large table table into the workbook and when I do and try to use the "highlight Macro" I get an error saying "subscript out of range" and it references this line in the code.

    Please Login or Register  to view this content.
    Any help in the right direction would be appreciated, thanks!

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Last edited by 6StringJazzer; 02-01-2014 at 01:18 PM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Problem with Code to "Click to highlight cell"

    Hi lp116 and welcome to the forum,

    I have a favorite site that speaks to Event Code. I think you should start by reading it.
    http://www.cpearson.com/excel/Events.aspx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    02-01-2014
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Problem with Code to "Click to highlight cell"

    Quote Originally Posted by MarvinP View Post
    Hi lp116 and welcome to the forum,

    I have a favorite site that speaks to Event Code. I think you should start by reading it.
    http://www.cpearson.com/excel/Events.aspx
    Thanks Marvin, I will definitely read through that. As this site is a little more then light reading lol im wondering if anyone had a more "quick fix".

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,718

    Re: Problem with Code to "Click to highlight cell"

    Please Login or Register  to view this content.
    xlNone is a special value of -4142 (same as xlColorIndexNone). When you start doing arithmetic on this to get other color index values you are going to get invalid values. ColorIndex is valid in the range 1-56. When you add -4142 to any color index you will get a negative value, which is invalid (unless the result is exactly -4142).

    So this leads me to ask what are you trying to do with that statement?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  2. [SOLVED] Add New Sheet,named based on cell value VBA problem and "smoother" code
    By herukuncahyono in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-09-2013, 01:59 AM
  3. Toggle BackColor of labels in Userform through "click" and "double-click"
    By ahmerjaved in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-20-2013, 02:08 PM
  4. If I click the Vendor 1 column of cell "J13" that value goes to place in worksheet of "Ve
    By suresh mongam in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2012, 02:41 PM
  5. Difference between manual "click" of activeX checkbox and coded "click"
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-23-2012, 10:51 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