J
JimO
I am trying to get data from a second file in same folde
What am I missing. Code reads as follows
CommandButton1 is in HC.xls Tab H
Private Sub CommandButton1_Click(
Dim xl As New Excel.Applicatio
Dim xlw As Excel.Workboo
Set xlw = xl.Workbooks.Open("C:\LKUP\HC_DB.XLS"
xlw.Sheets("m_data").Selec
'GET DAT
For Each CL In Worksheets("HC").Range("B1", Worksheets("HC").Range("B65536").End(xlUp).Address
If CL.Offset(1, 0).Text = Worksheets("M_DATA").Range("B2", Worksheets("M_DATA").Range("B65536").End(xlUp).Address)
The
With Worksheets("M_DATA").Range("B65536").End(xlUp).Offset(0, 0
.Value = CL.Valu
'LOCATION ON SHEET"HC" FROM LOCATION ON SHEET"HC_DB
.Offset(0, 1).Value = CL.Offset(0, 1).Valu
.Offset(0, 2).Value = CL.Offset(0, 4).Valu
.Offset(0, 3).Value = CL.Offset(0, 6).Valu
.Offset(0, 4).Value = CL.Offset(0, 7).Valu
.Offset(0, 5).Value = CL.Offset(0, 8).Valu
End Wit
End I
Next C
xlw.Close Fals
Set xlw = Nothin
Set xl = Nothin
End Su
What am I missing. Code reads as follows
CommandButton1 is in HC.xls Tab H
Private Sub CommandButton1_Click(
Dim xl As New Excel.Applicatio
Dim xlw As Excel.Workboo
Set xlw = xl.Workbooks.Open("C:\LKUP\HC_DB.XLS"
xlw.Sheets("m_data").Selec
'GET DAT
For Each CL In Worksheets("HC").Range("B1", Worksheets("HC").Range("B65536").End(xlUp).Address
If CL.Offset(1, 0).Text = Worksheets("M_DATA").Range("B2", Worksheets("M_DATA").Range("B65536").End(xlUp).Address)
The
With Worksheets("M_DATA").Range("B65536").End(xlUp).Offset(0, 0
.Value = CL.Valu
'LOCATION ON SHEET"HC" FROM LOCATION ON SHEET"HC_DB
.Offset(0, 1).Value = CL.Offset(0, 1).Valu
.Offset(0, 2).Value = CL.Offset(0, 4).Valu
.Offset(0, 3).Value = CL.Offset(0, 6).Valu
.Offset(0, 4).Value = CL.Offset(0, 7).Valu
.Offset(0, 5).Value = CL.Offset(0, 8).Valu
End Wit
End I
Next C
xlw.Close Fals
Set xlw = Nothin
Set xl = Nothin
End Su