Copy paste photo after selection

eliozo

Board Regular
Joined
Oct 22, 2010
Messages
80
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

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
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
What is the purpose of clicking on cell in column A?
 
Upvote 0
Its to choose the request number where i need to enlarge its photo beside the selected cell
 
Upvote 0

Forum statistics

Threads
1,214,947
Messages
6,122,413
Members
449,082
Latest member
tish101

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