1

I am creating a user form to easily submit date into multiple excel worksheets. Image of Application User GUI

You select which category at the top of the application and put the data you need in and hit submit. The user form moves all that to the correct worksheet based on, which category you selected. I want it to just append to the end of the current worksheet. I have everything working expect moving the images into worksheet from the user form.

Function addData(furnitureSelection)
Dim wks As Worksheet
Dim addnew As Range
Dim img As Picture
Dim Path As Variant
'Path = Application.GetOpenFilename(Title:="Select Picture To Be Imported")

If furnitureSelection = "Seating" Then
    Set wks = Sheet2
    Set addnew = wks.Range("A65356").End(xlUp).Offset(1, 0)
    addnew.Offset(0, 0).Value = Me.quantityTB.Text
    addnew.Offset(0, 1).Value = Me.descriptionTB.Text
    addnew.Offset(0, 2).Value = "$" + Me.priceTB.Text + ".00"
    addnew.Offset(0, 3).Value = ""
            
    
    Set img = addnew.Insert(Me.image1URL.Caption)
    
    With img
        .PictureSizeMode = 3
        .Left = addnew.Left
        .Top = addnew.Top
        .Height = addnew.Height
        .Placement = 1
        .PrintObject = True
    End With
    
    'postmessage ("seating")
ElseIf furnitureSelection = "Desks" Then

I am brand new to coding with VBA. What I have now I found on some web forum. I might have played with it a little. Been messing around with it a lot. I just need everything to append to the end of the worksheet. Cell A is Quantity, Cell B is description, Cell C is price, and Cell D I want to have up to two images to show the inventory. So I need to size the images properly to Cell D while also being able to fit a second photo if need be.

One more thing to note is image1URL is just a hidden label to paste the file destination of the photo.

The error that's popping up:

Run-time error '1004':
Unable to get the Insert property of the Range class
matt bins
  • 11
  • 1
  • https://stackoverflow.com/questions/12936646/how-to-insert-a-picture-into-excel-at-a-specified-cell-position-with-vba – Tim Williams Apr 27 '22 at 16:49

0 Answers0