ced0802
12-04-2015, 05:23 AM
Hello everyone,
I would like to include in my code that it puts comment only if cells in columns "N" of workbooks ("Stocks") = "Y"
Thank you very much for your help.
Sub position()
Dim ws As Worksheet, rng As Range, x As Long, temp
Set ws = Workbooks("Wk49production").Sheets("packing production schedule")
Set rng = Workbooks("Stocks").Worksheets("wms_browse").Range("D2:Q2000")
For x = 1 To 1000
With ws.Cells(x, 5)
temp = Application.VLookup(ws.Cells(x, 35), rng, 14, False)
If .Comment Is Nothing Then
.AddComment CStr(temp)
Else
.Comment.Text CStr(temp)
End If
End With
Next
End Sub
I would like to include in my code that it puts comment only if cells in columns "N" of workbooks ("Stocks") = "Y"
Thank you very much for your help.
Sub position()
Dim ws As Worksheet, rng As Range, x As Long, temp
Set ws = Workbooks("Wk49production").Sheets("packing production schedule")
Set rng = Workbooks("Stocks").Worksheets("wms_browse").Range("D2:Q2000")
For x = 1 To 1000
With ws.Cells(x, 5)
temp = Application.VLookup(ws.Cells(x, 35), rng, 14, False)
If .Comment Is Nothing Then
.AddComment CStr(temp)
Else
.Comment.Text CStr(temp)
End If
End With
Next
End Sub