PDA

View Full Version : is this possible ? (product invioice)



mercmannick
05-07-2006, 09:39 AM
i have a invoice s/sheet, (enclosed).

what i am tryingto acheive is on invoice sheet if product matches , then insert this jpeg from product printers sheet



regards


Merc

geekgirlau
05-08-2006, 10:06 PM
I have a partial solution. This assumes that the product selected in the Invoice is within a range named "InvoiceItem", and that each image is given a sequential number, which is listed in a new "Picture ID" column on the "Products Printers" sheet. When you perform a vlookup on the product name, the "Picture ID" tells you the name of the image (for example, 1 corresponds with the image "pic1").

I haven't worked out how to remove any existing image from the invoice first, nor have I made any attempt to position the image.


Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("InvoiceItem")) Is Nothing Then
CopyImage Target
End If
End Sub

Sub CopyImage(rng As Range)
Dim intPic As Integer


On Error Resume Next
intPic = WorksheetFunction.VLookup(rng, Range("ProductInfo"), 4, False)

If Err.Number = 0 Then
Sheets("Products Printers").Shapes("pic" & intPic).Copy
rng.Offset(0, 1).Select
ActiveSheet.Paste
Application.CutCopyMode = False
End If
End Sub

mercmannick
05-09-2006, 08:52 AM
geekgirlau (http://www.vbaexpress.com/forum/member.php?u=450)

thank you it is good just need to tweak the position a bit

Many Thanks

Merc