Hi
I have a workbook that are adding rows on different pages and they all refer to each other with item numbers, description etc on items.
all sheets are locked except for some cells where different departments add in information
On one of the sheets i want to be able to insert pictures in specific cells.
i want it to that you click on the row and click a button that are located in the top of the sheet where the item shall be inserted by using
("E" & (ActiveCell.Row))
i have found one string (see below) that insert the image but how do i get it into the correct cell?
i also need it to be able to filter the sheet and that the images are fixed to the row when sorting by filter.
Thanks in advance
//M
Sub InsertImage()
ActiveSheet.Unprotect "password"
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.ButtonName = "Submit"
.Title = "Select an image file"
.Filters.Clear
.Filters.Add "JPG", "*.JPG"
.Filters.Add "JPEG File Interchange Format", "*.JPEG"
.Filters.Add "Graphics Interchange Format", "*.GIF"
.Filters.Add "Portable Network Graphics", "*.PNG"
.Filters.Add "Tag Image File Format", "*.TIFF"
.Filters.Add "All Pictures", "*.*"
If .Show = -1 Then
Dim img As Object
Set img = ActiveSheet.Pictures.Insert(.SelectedItems(1))
img.Left = 50
img.Top = 150
img.Width = 68
img.Height = 22
Placement = xlMoveAndSize
Else
MsgBox ("Cancelled.")
End If
End With
ActiveSheet.Protect "password", AllowFiltering:=True, AllowFormattingCells:=True, DrawingObjects:=False
End Sub
I have a workbook that are adding rows on different pages and they all refer to each other with item numbers, description etc on items.
all sheets are locked except for some cells where different departments add in information
On one of the sheets i want to be able to insert pictures in specific cells.
i want it to that you click on the row and click a button that are located in the top of the sheet where the item shall be inserted by using
("E" & (ActiveCell.Row))
i have found one string (see below) that insert the image but how do i get it into the correct cell?
i also need it to be able to filter the sheet and that the images are fixed to the row when sorting by filter.
Thanks in advance
//M
Sub InsertImage()
ActiveSheet.Unprotect "password"
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.ButtonName = "Submit"
.Title = "Select an image file"
.Filters.Clear
.Filters.Add "JPG", "*.JPG"
.Filters.Add "JPEG File Interchange Format", "*.JPEG"
.Filters.Add "Graphics Interchange Format", "*.GIF"
.Filters.Add "Portable Network Graphics", "*.PNG"
.Filters.Add "Tag Image File Format", "*.TIFF"
.Filters.Add "All Pictures", "*.*"
If .Show = -1 Then
Dim img As Object
Set img = ActiveSheet.Pictures.Insert(.SelectedItems(1))
img.Left = 50
img.Top = 150
img.Width = 68
img.Height = 22
Placement = xlMoveAndSize
Else
MsgBox ("Cancelled.")
End If
End With
ActiveSheet.Protect "password", AllowFiltering:=True, AllowFormattingCells:=True, DrawingObjects:=False
End Sub