+ Reply to Thread
Results 1 to 5 of 5

unable to read cell text data

  1. #1
    Registered User
    Join Date
    03-10-2010
    Location
    Cyberjaya, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    3

    unable to read cell text data

    Hi all,

    I have created a macro which looks like below:

    Please Login or Register  to view this content.
    As you can see, i am comparing cell values in Column A and B, if both not the same, i insert empty cell in column B. however , it seems to be working only for numbers..but not texts or strings..

    its a simple macro which i use in day to day jobs..but when it comes to 700 rows of strings..i have to manually read each line and compare

    how do i read string values? is the above code correct? fyi..this is my first macro code :D so do be gentle to me
    Last edited by tehyavanna; 03-10-2010 at 07:48 AM.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: unable to read cell text data

    Hi,

    Are the text strings all the same case? It can help when comparing text string to make them the same case before comparing them.

    If that's not it maybe you could upload a sample workbook with a some example of where it's not working.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    03-10-2010
    Location
    Cyberjaya, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: unable to read cell text data

    Hi Dom,

    Thanks for the reply.

    I attached the sample data for your perusal. Some are pure numbers, and some are numbers with hyphens or alphabets.
    Attached Files Attached Files

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: unable to read cell text data

    Your problem was all the values in column A have trailing spaces. You can fix this using the Trim function.

    This code should do what you require I think:

    Please Login or Register  to view this content.

    Hope it helps,

    Dom

  5. #5
    Registered User
    Join Date
    03-10-2010
    Location
    Cyberjaya, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: unable to read cell text data

    Hey Dom!

    It worked wonderfully!!! Thanks!!


+ 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