+ Reply to Thread
Results 1 to 9 of 9

Excel Macro End if

  1. #1
    Registered User
    Join Date
    11-18-2008
    Location
    USA
    Posts
    54

    Excel Macro End if

    Hi I have the following part of a macro. What I need it to do is check if each cell in column U have the value a,b,c,d, or is blank. If it is one of those values (or is blank) then continue on to the rest of my macro. However, if it is not one of those values then create a message box saying which cell it is in, and end the macro.

    I started writing a little below, but got confused at this point.


    Thanks to anyone who can help.


    Please Login or Register  to view this content.
    Last edited by b50; 09-15-2010 at 04:13 PM.

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Excel Macro End if

    b50,

    Try:


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).


    Please Login or Register  to view this content.


    Or, try:


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).


    Please Login or Register  to view this content.
    Last edited by stanleydgromjr; 09-13-2010 at 06:24 PM.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Excel Macro End if

    Hi

    see how this goes
    Please Login or Register  to view this content.
    rylo

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Excel Macro End if

    Another way:
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    11-18-2008
    Location
    USA
    Posts
    54

    Re: Excel Macro End if

    Ok, I adjusted teh code a little, just so that it matches the names I need, but for some reason the error message keeps coming up. The names in the code exactly match what is in the spreadsheet, but it is still having problems.

    Any idea what is going on?


    Thanks for your help.

    Please Login or Register  to view this content.



    Quote Originally Posted by stanleydgromjr View Post
    b50,

    Try:


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).


    Please Login or Register  to view this content.


    Or, try:


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).


    Please Login or Register  to view this content.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Excel Macro End if

    Hello b50,

    The code UCase converts all of the letters in a string to capitals. If you want to capitalize only the first letter of each word then you need to use the Proper function. I have added this function to the macro below.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  7. #7
    Registered User
    Join Date
    11-18-2008
    Location
    USA
    Posts
    54

    Re: Excel Macro End if

    Works perfect thanks!!!
    Last edited by shg; 09-15-2010 at 04:32 PM. Reason: deleted spurious quote

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    re: Excel Macro End if

    b50, please don't quote whole posts -- it's just clutter.

    Thanks.

  9. #9
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Excel Macro End if

    b50,

    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    Please Login or Register  to view this content.

+ 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