jonnyjonjon
11-13-2017, 06:01 PM
Hello all,
I am trying to come up with a program that is able copy the values in the cells of column A of workbook 1, IF the value in the cells of column J for that row is "Customer A". And afterwards, paste it into cell A2 of workbook 2.
I've came up with the following program but I've hit a roadblock.
Dim x as workbook
Dim y as workbook
Dim lastrow as integer
Dim i as integer
Set x =workbooks.open("D:\......Workbook 1")
with x.sheets("sheet 1")
lastrow = activesheet.range("A" & Rows.Count).End(xlUp).Row
For i = 2 to last row
If range("J" & i).value = "Customer A" then
'how to copy this value or select it ?
end if
next i
end with
set y = workbooks.open("D:\......Workbook 2")
with y.sheets("sheet1")
'paste the copied values in range("A2")
Thank you in advance for the help provided
I am trying to come up with a program that is able copy the values in the cells of column A of workbook 1, IF the value in the cells of column J for that row is "Customer A". And afterwards, paste it into cell A2 of workbook 2.
I've came up with the following program but I've hit a roadblock.
Dim x as workbook
Dim y as workbook
Dim lastrow as integer
Dim i as integer
Set x =workbooks.open("D:\......Workbook 1")
with x.sheets("sheet 1")
lastrow = activesheet.range("A" & Rows.Count).End(xlUp).Row
For i = 2 to last row
If range("J" & i).value = "Customer A" then
'how to copy this value or select it ?
end if
next i
end with
set y = workbooks.open("D:\......Workbook 2")
with y.sheets("sheet1")
'paste the copied values in range("A2")
Thank you in advance for the help provided