ced0802
12-01-2015, 03:35 PM
Hi everyone,
MACRO MODULE 5 :
In workbook "macro deliveries", I would like the quantities sheet ''feuil1'' column C to be transfered into workbook "Wk49"
column 5 to have for instance :
5N - 2Y [+17000]on Del 21.02
It works BUT it puts values for every cells in workbook "WK49". (I'd like to keep for instance 5N-2Y when no values on first Workbook)
5N - 2Y [] on Del 21.02 instead of 5N - 2Y
Thank you very much in advance for all your help ! (hope it makes sense)
Code:
Sub exp()
Dim ws As Worksheet
Set ws = Workbooks("wk49production").Sheets("Packing Production Schedule")
Set rng = Workbooks("deliveries macro").Worksheets("feuil1").Range("A13:C105")
For x = 1 To 1000
For y = 13 To 150
On Error Resume Next
If Workbooks("deliveries macro").Worksheets("feuil1").Cells(y, 3).Value <> "" Then
ws.Cells(x, 5) = Left(ws.Cells(x, 5), 5) & "+" & "[" & Application.VLookup(ws.Cells(x, 7), rng, 3, False) & "]" & _
"on " & Application.VLookup(Workbooks("deliveries macro").Worksheets("feuil1").Cells(10, 3), Range("C10:J10"), 1, False)
On Error Resume Next
End If
Next y
Next x
End Sub
MACRO MODULE 5 :
In workbook "macro deliveries", I would like the quantities sheet ''feuil1'' column C to be transfered into workbook "Wk49"
column 5 to have for instance :
5N - 2Y [+17000]on Del 21.02
It works BUT it puts values for every cells in workbook "WK49". (I'd like to keep for instance 5N-2Y when no values on first Workbook)
5N - 2Y [] on Del 21.02 instead of 5N - 2Y
Thank you very much in advance for all your help ! (hope it makes sense)
Code:
Sub exp()
Dim ws As Worksheet
Set ws = Workbooks("wk49production").Sheets("Packing Production Schedule")
Set rng = Workbooks("deliveries macro").Worksheets("feuil1").Range("A13:C105")
For x = 1 To 1000
For y = 13 To 150
On Error Resume Next
If Workbooks("deliveries macro").Worksheets("feuil1").Cells(y, 3).Value <> "" Then
ws.Cells(x, 5) = Left(ws.Cells(x, 5), 5) & "+" & "[" & Application.VLookup(ws.Cells(x, 7), rng, 3, False) & "]" & _
"on " & Application.VLookup(Workbooks("deliveries macro").Worksheets("feuil1").Cells(10, 3), Range("C10:J10"), 1, False)
On Error Resume Next
End If
Next y
Next x
End Sub