+ Reply to Thread
Results 1 to 2 of 2

VB FIND works properly for First Split in Array, but not Subsequent Splits

  1. #1
    Registered User
    Join Date
    03-11-2013
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    3

    VB FIND works properly for First Split in Array, but not Subsequent Splits

    All,

    I have a VB Script that is functioning properly but has two minor issues that I can't seem to fix.

    Script Purpose: The script compares two worksheets. It uses comma separated entries in the 'CTP' sheet and attempts to find a corresponding match (via the Split and Find commands) in the 'SRTM' sheet. If a match is found, it copies the corresponding entry from Column A of the 'CTP' sheet to Column B of the 'SRTM' sheet.

    Issue #1: It copies only the first split for each cell properly. It does not work for any of the subsequent splits in the For Loop, even though each split (array element) has a valid value and should be findable in the spreadsheet.

    Issue #2: There are some cases where multiple matches occur and the script needs to be able to append a value to the cell rather than overwrite the value. This issue is with the following line: Sheets("SRTM").Cells(c4.Row, 2) = c3.Offset(, -1)

    The script that needs to be reworked is below. The sample worksheets are attached as well.

    Thanks in advance.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: VB FIND works properly for First Split in Array, but not Subsequent Splits

    Hi,

    Attached is my solution. Hope this helps.
    Attached Files Attached Files
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

+ 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