+ Reply to Thread
Results 1 to 5 of 5

Issues with running a Procedure in Excel 2003

  1. #1
    Registered User
    Join Date
    05-14-2012
    Location
    Gurgaon
    MS-Off Ver
    Excel 2003
    Posts
    2

    Issues with running a Procedure in Excel 2003

    Hi,

    I'm new to VBA and following a book called Mastering Excel 2003 Programming with VBA to learn. I'm stuck on one of the examples given in the book. Please see the details below:

    1: I've created an Excel sheet under C:\Examples\ named Example.xls. The sheet1 os the excel has data in Column B3 (="animal"), Column B4 (="art") and Column B5 (="test"). The pupose of the code (Below) is to make the column bold if the data starts with "a".

    2: As given in the book, I've added a module to this sheet & copied the below code to the module:
    Please Login or Register  to view this content.
    3: However, when I try to execute the above mentioned code, the strange thing is that Nothing Happens. What I mean is that No Error is thrown & nor does the data in sheet1 is made bold.

    Can someone pls help me understand what exactly is the issue here?

    Note: Just to make sure if other piece of code is running through a module, I added the below code to module & it works (Gives me an Output):
    Please Login or Register  to view this content.
    Last edited by arlu1201; 05-14-2012 at 08:07 AM. Reason: Please use code tags in future as per forum rules.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Issues with running a Procedure in Excel 2003

    In Excel the letters "a" and "A" are not automatically equivalent. You can tell Excel to treat upper and lower case as equivalent in the macros in that module by putting this at the top of that module:

    Please Login or Register  to view this content.

    Other ways is to fix the test so it matches the lower case values:
    Please Login or Register  to view this content.

    Or making the string upper case before you test "A":
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Issues with running a Procedure in Excel 2003

    Hello there,

    Are the values in B3 and B4 capitalized? In other words in B3 is it "animal" or "Animal" and in B4 is it "art" or "Art"? In VBA things are case sensitive so if in your Example worksheet the values begin with a lowercase "a" then VBA does not recognize them as "A". Change the "A" in the code to "a" or capitalize the "a" in animal and art to make the code run correctly.

    Let me know if this works!

    Thanks!

  4. #4
    Registered User
    Join Date
    05-14-2012
    Location
    Gurgaon
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Issues with running a Procedure in Excel 2003

    Hi,

    I did tried with both the options (Using the Font as "a" instead of "A" and by mentioning the Compare Text code.

    However, still nothing is happening.

    Is this because I'm trying to open a Sheet, which is already opened?

    Thanks,

  5. #5
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Issues with running a Procedure in Excel 2003

    Are you trying to run this from the Example workbook. In other words do you have the code written in the Example workbook and not another workbook?

+ 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