The procedure for opening a dialog to select files:
Sub OpenPictureDialog() With Application.FileDialog(msoFileDialogOpen) .ButtonName = "ΠΡΠ±ΡΠ°ΡΡ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΠ΅" .Title = "ΠΠΎΠ±Π°Π²ΠΈΡΡ Π²ΡΠ±ΡΠ°Π½Π½ΠΎΠ΅ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΠ΅" ' ΠΠ°ΡΠ°Π»ΡΠ½ΡΠΉ ΠΊΠ°ΡΠ°Π»ΠΎΠ³ Ρ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΡΠΌΠΈ .InitialFileName = "C:\Users\admin\Pictures\" .Filters.Clear ' Π€ΠΈΠ»ΡΡΡ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΠΉ, Π² Π΄Π°Π½Π½ΠΎΠΌ ΡΠ»ΡΡΠ°Π΅ ΡΠΎΠ»ΡΠΊΠΎ *.jpeg, *.jpg .Filters.Add "Π€Π°ΠΉΠ»Ρ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΠΉ", "*.jp*" If .Show <> -1 Then Exit Sub ActiveSheet.Pictures.Insert(.SelectedItems(1)).Select PS = Application.PathSeparator End With End Sub
If you need to insert a picture directly into the cell itself, then it is better to add another macro from here .
The procedure for opening a form with input fields:
Sub InsertRow() ' ΠΠΎΠΊΠ°Π·ΡΠ²Π°Π΅ΠΌ ΡΠΎΡΠΌΡ Π²Π²ΠΎΠ΄Π° ΡΠΈΡΠΈΠ½Ρ/Π²ΡΡΠΎΡΡ ΡΡΠ΅Π΅ΠΊ AddRow.Show End Sub
The main macro that calls previous procedures and draws a button:
Sub AddButton() Dim btnX1, btnX2, btnY1, btnY2 As Integer Dim padding As Integer Dim r, rH, c, cW As Integer padding = 3 r = ActiveCell.row - 1 rH = 0 c = ActiveCell.Column - 1 cW = 0 For i = 1 To r rH = rH + Rows(i).Height Next i For i = 1 To c cW = cW + Columns(i).Width Next i ' ΠΠΎΠΎΡΠ΄ΠΈΠ½Π°ΡΡ ΠΊΠ½ΠΎΠΏΠΊΠΈ Π² ΡΡΠ΅ΠΉΠΊΠ΅ btnX1 = cW + padding btnY1 = rH + padding btnX2 = ActiveCell.Height - padding * 2 btnY2 = ActiveCell.Height - padding * 2 ' ΠΠΎΠ±Π°Π²Π»ΡΠ΅ΠΌ ΠΊΠ½ΠΎΠΏΠΊΡ Π² Π°ΠΊΡΠΈΠ²Π½ΡΡ ΡΡΠ΅ΠΉΠΊΡ ActiveSheet.Buttons.Add(btnX1, btnY1, btnX2, btnY2).Select ' ΠΠΎΠ±Π°Π²Π»ΡΠ΅ΠΌ Π²ΡΠ±ΡΠ°Π½Π½ΡΡ ΠΊΠ°ΡΡΠΈΠ½ΠΊΡ Π½Π° ΡΡΡΠ°Π½ΠΈΡΡ ' Selection.OnAction = "OpenPictureDialog" ' ΠΡΡΠ°Π²Π»ΡΠ΅ΠΌ Π½ΠΎΠ²ΡΡ ΡΡΡΠΎΠΊΡ ΠΏΠΎΠ΄ Π°ΠΊΡΠΈΠ²Π½ΠΎΠΉ ΡΡΠ΅ΠΉΠΊΠΎΠΉ ' Selection.OnAction = "InsertRow" Selection.Caption = "+" End Sub
Depending on the requirements, uncomment either Selection.OnAction = "OpenPictureDialog"
or Selection.OnAction = "InsertRow"
The input form itself:

Code for the OK
button:
Private Sub InsertButton_Click() If CellWidth.Text = "" Or CellHeight.Text = "" Then MsgBox ("ΠΠ½Π°ΡΠ΅Π½ΠΈΠ΅ Π½Π΅ ΡΠΊΠ°Π·Π°Π½ΠΎ!") End If Rows(ActiveCell.row + 1).Select Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove Selection.RowHeight = Val(CellHeight.Text) Selection.ColumnWidth = Val(CellWidth.Text) Close End Sub