I need to click on a button and select a cell in column A in sheet (sheet1). In column B, there’s a photo; I need to copy and paste this photo to another sheet (maintenance Request) in excel on cell C20.
The code is not working. It’s giving me instead of the photo a text “activecell.offset(0,1).value”.
Thank you for your help
The code is not working. It’s giving me instead of the photo a text “activecell.offset(0,1).value”.
Thank you for your help
Private Sub CommandButton1_Click()
On Error Resume Next
Dim Workrng As Range
On Error Resume Next
xTitleId = " Request"
Set Workrng = Application.Selection
Set Workrng = Application.InputBox("Select a cell in column A", xTitleId, Workrng.Address, Type:=8)
Application.ScreenUpdating = False
Workrng.Select
Dim pic As Shape
Application.CutCopyMode = False
Workrng.Value = ActiveCell.Offset(0, 1).Value
Worksheets("Sheet1").Range("Workrng").Copy
With Worksheets("Maintenance Request")
.Activate
.Range("C20").Select
.Pictures.Paste
For Each pic In .Shapes
If pic.TopLeftCell.Address(0, 0) = "C20" Then
pic.Select
With Selection
.ShapeRange.LockAspectRatio = msoFalse
.ShapeRange.Height = 150
.ShapeRange.Width = 300
End With
End If
Next pic
End With
End Sub