View Full Version : [SOLVED] IF different from blank then

12-01-2015, 03:35 PM
Hi everyone,


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)


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

12-02-2015, 01:36 AM
Hello Guys,

I have found the solution so I'm closing the topic.

12-02-2015, 01:50 AM
welcome to the forum.

you are too fast. :D

it is considered a good practice to post the solution (or the link, if resolved in another forum) in online communities in case someone will need it in the future.