+ Reply to Thread
Results 1 to 10 of 10

Doubt in using array - VBA

  1. #1
    Registered User
    Join Date
    02-28-2013
    Location
    Chennai, India
    MS-Off Ver
    Excel 2010
    Posts
    5

    Thumbs up Doubt in using array - VBA

    I have two string variables in which I'll be getting different string values, following that I'll compare both the values as character by character. So, I just wanted to assign those string values into array and split-up into single, single characters then will compare with each.

    Can anyone give me small hint on this point? Just let me know the way to split up and usage of array, based on which I can design my own code properly.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Doubt in using array - VBA

    You first load the range in to an array, let say you have

    Please Login or Register  to view this content.
    ' change this to suit your requirements

    and then you loop through an array

    Please Login or Register  to view this content.
    Then assign you value in to split function and the split loop through again and so on

    Please Login or Register  to view this content.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Doubt in using array - VBA

    There's no simple way to split a string into characters.

    If you want to compare two strings you can loop through the characters.
    Please Login or Register  to view this content.
    Last edited by Norie; 03-01-2013 at 01:50 PM.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    02-28-2013
    Location
    Chennai, India
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Doubt in using array - VBA

    Thanks buddy,,,, i'll try this and get back my view to board shortly!

  5. #5
    Registered User
    Join Date
    02-28-2013
    Location
    Chennai, India
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Doubt in using array - VBA

    I've desinged my own code to compare two cells and highlight the mismatching characters alone, it doesn't throw any error. However it is highlighting complete string instead of mismatching characters. I understood that the mistake would be with character highlighting part, but as of my knowledge it looks correct. Can anyone point my mistake and correct it from below code?

    Please Login or Register  to view this content.
    Please do the required!
    Last edited by vbamania; 03-01-2013 at 11:39 PM.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Doubt in using array - VBA

    I'm afraid your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Doubt in using array - VBA

    There is a way to split the string into an array at a time.

    Deleted the code

  8. #8
    Registered User
    Join Date
    02-28-2013
    Location
    Chennai, India
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Doubt in using array - VBA

    Apologize for this! In fact I wanted to resolve this ASAP due to inadequate timeline. That’s why, forgot to mention another post’s UI as well. Hereon I’ll make sure, not to violate any forum rules!

    http://<br /> http://www.mrexcel.com...ons.html<br />

    I've got solution for this thread and hence closing this thread as solved. Thanks for your timed instructions Norie!

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Doubt in using array - VBA

    Example
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    02-28-2013
    Location
    Chennai, India
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Doubt in using array - VBA

    Thanks jin I got few new ways from your code,,, It was good learning curve completely

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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