Q:

To import data from file to existing workbook using Vlookup

I have a main workbook and a sub workbook that macro commands to open
1) Main workbook = Database 
Worksheet in Main Workbook = Customer database
Sub workbook = Orders  
These two books are open for macro to run.
1) I need to import data Range C:F from Orders to Customer Database B:E if Cell B from Orders contains New Member
2) The worksheet in database already contains data. Hence, I want it to add on to the existing sheet in Database
Please help.
Dim wsSource As Worksheet
Dim wbSource As Workbook
Dim wsTarget As Worksheet
Dim wbTarget As Workbook
Dim findRange As Range
Dim lastline As Integer
Dim file As String

file = "Orders.xlsx"
Set wbSource = ThisWorkbook
Set wsSource = wbSource.Sheets(1)
Set wbTarget = Workbooks.Open(file)
Set wsTarget = wbTarget.Sheets(1)

wsTarget.Activate

Set findRange = wsTarget.Range("C2:F389")
findRange.Replace What:="xxx-string",Replacement:=wsSource.Range("b2:e2").Value, LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False

lastline = wbSource.Sheets(1).Range("X65536").End(xlUp).Row

Dim d As Integer
Dim j As Integer

d = 3
j = 2

For b = 1 To lastline
    If wsTarget.Range("B" & j) = "New Member" Then
        d = d + 1
        wsSource.Range("B" & j).Value = wsTarget.Range("C" & d).Value
        wsSource.Range("C" & j).Value = wsTarget.Range("D" & d).Value
        wsSource.Range("D" & j).Value = wsTarget.Range("E" & d).Value
        wsSource.Range("E" & j).Value = wsTarget.Range("F" & d).Value
    End If
    j = j + 1
Next b

A:

This answer is based on items 1 and 2 you enumerated above.
I'm not sure what you want to accomplish with the .Replace method so I remove it.
Sub Consolidate()

Dim wsSource As Worksheet
Dim wbSource As Workbook
Dim wsTarget As Worksheet
Dim wbTarget As Workbook
Dim findRange As Range
Dim lastline As Integer
Dim file As Variant '~~> declared as Variant

Set wbSource = Thisworkbook
Set wsSource = wbSource.Sheets(1) '~~>use index only if you have 1 sheet only

file = Application.GetOpenFilename("Excel Files, *.xlsx") '~~> allows you to select the file to load

If file <> False Then
    Set wbTarget = Workbooks.Open(file)
    Set wsTarget = wbTarget.Sheets(1)

    With wsTarget
        lastline = .Range("B"  & .Rows.Count).End(xlUp).Row
        Set findRange = .Range("B1:F" & lastline)
        With findRange
            .Autofilter 1, "New Member"
            .Offset(1,1).Resize(.Rows.Count-1, .Columns.Count-1).SpecialCells(xlCellTypeVisible).Copy _
            wsSource.Range("B" & wsSource.Rows.Count).End(xlUp).Offset(1,0)
        End With
    End With
Else
    MsgBox "No file selected. Exiting now." : Exit Sub
End If
wbTarget.Close False
wbSource.Save

End Sub

No need to loop through the whole range.
I used .AutoFilter method instead.
Hope this is close to what you want.

