+ Reply to Thread
Results 1 to 5 of 5

Code Optimization for Inserting Comment for Mouseover Using VLookup

  1. #1
    Registered User
    Join Date
    02-12-2017
    Location
    Los Angeles, CA
    MS-Off Ver
    2016
    Posts
    3

    Code Optimization for Inserting Comment for Mouseover Using VLookup

    Hi,
    I am very new to programming in VBA for excel. I have created a working piece of code that looks up a value in a different sheet using Vlookup and then places that value into a comment box, and lastly resizes the comment box to fit the text.

    This allows the comment to be shown while the mouse is hovering over the cell for quick reference.

    The code also erases the comment when the information in the cell is erased or a piece of text is used in place of a number in the cell, and places a pop-up when a number value is not on the lookup list. This is because the column that I am searching in is all numbers, and if someone is placing a letter in the cell, then the user has not defined the project number yet, so it is okay as a place holder till a project number is assigned, but I want to warn the user if they place a number that is not on the list.

    The code also tries to capture as much error checking as possible.
    Since I am new to VBA, I would appreciate some feedback on how to optimize this code (ie. run faster, smoother, eliminate other possible errors, etc...).

    Thanks for the feedback in advance.

    Code:

    Please Login or Register  to view this content.
    Last edited by slice723; 02-13-2017 at 01:30 AM. Reason: Abide to Forum Rules

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Code Optimization for Inserting Comment for Mouseover Using VLookup

    Interesting Project

    Welcome to the forum

    However you will get few responses as you have breached one of the forum rules. Sorry.




    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    02-12-2017
    Location
    Los Angeles, CA
    MS-Off Ver
    2016
    Posts
    3

    Re: Code Optimization for Inserting Comment for Mouseover Using VLookup

    Thank you for letting me know. I have corrected as commented.

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Code Optimization for Inserting Comment for Mouseover Using VLookup

    Your code looks good to me

    You do however fave two redundant lines

    You also omitted to reset default error handling.


    My edited Version:

    Please Login or Register  to view this content.
    You Version with ammendments:-

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-12-2017
    Location
    Los Angeles, CA
    MS-Off Ver
    2016
    Posts
    3

    Re: Code Optimization for Inserting Comment for Mouseover Using VLookup

    Thank you for your comments. They helped me become aware of the error handling expressions.

+ 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. Code Optimization
    By douglascaixeta in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-03-2014, 06:45 AM
  2. Code Optimization for Fun
    By Mordred in forum The Water Cooler
    Replies: 15
    Last Post: 07-23-2011, 12:47 PM
  3. Optimization VBA code
    By ahmad123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-07-2011, 05:35 PM
  4. Code optimization
    By d_omin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-27-2010, 04:13 AM
  5. Code Optimization
    By adyan76 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-05-2009, 08:36 AM
  6. VBA optimization of code
    By Fazered in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-16-2007, 12:36 PM
  7. [SOLVED] VLOOKUP with mouseover?
    By Cheese in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-30-2005, 12:05 AM

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