Results 1 to 2 of 2

Compare String

Threaded View

  1. #1
    Forum Contributor
    Join Date
    04-13-2012
    Location
    germany
    MS-Off Ver
    Excel 2003
    Posts
    185

    Compare String

    Hell Every body
    I want to compare the two strings in one worksheet and when the string is matched then open the new workbook automatically and the column next to the matched string is written to the new open workbook cell B1. The code is written below it just match the string, when the string is matched then it open the new workbook, but the next step in which i am fail is that i cannot copy the data from one workbook to other, and the sample workbook is also attached with this email.

    Sub Test()
    Dim i As Integer
    Dim string
    i = 5
    string = "C:\Documents and setting\Desktop\Macro\Test1.xls"
    Do Until IsEmpty(ThisWorkbook.Sheets(1).Cells(i, 2))
        If (ThisWorkbook.Sheets(1).Cells(i, 2) Like ThisWorkbook.Worksheets(1).Cells(1, 2)) Then Workbooks.Open (string)
    i = i + 1
     
    Loop
    End Sub
    Attached Files Attached Files

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