Add image from Userform to corresponding data entered on each row

hsolanki

Board Regular
Joined
Jan 16, 2020
Messages
204
Office Version
  1. 2010
Platform
  1. Windows
Hi i have userform with the all the data adds to the "VehicleRejected" Sheet from a userform however i have added an code for user to select an image from their drive and now i want userform to add the image against the data on same row.

below it is placed in a image2, whereby user can select the picture;

VBA Code:
Dim strFileName As String

strFileName = Application.GetOpenFilename(filefilter:="Tiff Files(*.tif;*.tiff),*.tif;*.tiff,JPEG Files (*.jpg;*.jpeg;*.jfif;*.jpe),*.jpg;*.jpeg;*.jfif;*.jpe,Bitmap Files(*.bmp),*.bmp", FilterIndex:=2, Title:="Select a File", MultiSelect:=False)

TextBox1 = strFileName  'use to save URL or Link from picture

If strFileName = "False" Then
    MsgBox "File Not Selected!"
    Else
    'load picture to Image control, using LoadPicture property
    Me.Image2.Picture = LoadPicture(strFileName)
    'after any change vba has to be told to refresh the UserForm for the change to appear
    Me.Repaint
    'label caption changes after picture is loaded
    'Me.Label1.Caption = "Logo loaded"
End If

below code which is in command button will add all the date from userform to sheet call "VehicleRejected"

VBA Code:
sh.Range("A" & n + 1).Value = Format(Now, "dd/mm/yyyy")
sh.Range("A" & n + 1).Value = CDate(Me.TextBox8)
sh.Range("B" & n + 1).Value = Me.TextBox35.Value
sh.Range("C" & n + 1).Value = Me.TextBox9.Value
sh.Range("D" & n + 1).Value = Me.ComboBox3.Value
sh.Range("E" & n + 1).Columns.AutoFit
sh.Range("D" & n + 1).Value = Me.TextBox10.Value
sh.Range("E" & n + 1).Columns.AutoFit
sh.Range("F" & n + 1).Value = Me.TextBox11.Value
sh.Range("F" & n + 1).Columns.AutoFit
sh.Range("G" & n + 1).Value = Me.TextBox12.Value
sh.Range("H" & n + 1).Value = Environ("username")
sh.Range("I" & n + 1).Value = Me.Image2
sh.Range("J" & n + 1).Value = Me.Image3

i want to know if it is possible for image that uploaded on the userform which is in image2 can it be also inserted on to the sheet in column I, J, K , L on same row as the date entered with auto size adjusted.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top