Report

Inserting image in a particular cell in VBA [Solved]

Ask a question adikademani - Last answered on Nov 9, 2016 02:44PM
Hello All,

I wanna insert an image into the Activecell but the image is getting inserted into the same default area. Kindly help me regarding this by checking the code below

Sub pics()

Range("Q1").Activate

ActiveSheet.Pictures.Insert ("E:\personal\adi.jpg")

End Sub
See more 
Helpful
+0
moins plus
Hi adikademani,

To place the image in the active cell instead of Q1 then replace:
Range("Q1").Activate
By:
ActiveCell.Activate

Best regards,
Trowa
Add comment
Helpful
+0
moins plus
Hi Trowa,

thanks for the quick reply, but the image is still not getting inserted into that particular cell. For example, how do i insert a picture into the Cell Q1 ?
TrowaD 2033Posts Sunday September 12, 2010Registration date ModeratorStatus December 6, 2016 Last seen - Nov 1, 2016 11:45AM
There must be some misunderstanding, because the code you posted does that. Where does the picture go if not Q1?
Reply
adikademani- Nov 2, 2016 06:22AM
Hi Trowa,

Thanks a lott, the issue is solved.
I need some more help with the following. I am trying to insert an image into a particular cell by calling the value stored in the variable via an InputBox. The following code is showing error. Kindly help me. Thank u :)

Sub image()

Dim x As String
x = InputBox("insert image name")


Range("E5").Select

ActiveSheet.Pictures.Insert( _
"G:\PEP\04.Kaizen\KAIZEN Audit\02 Auditfragebögen\5S questionaire\ x "). _
Select

End Sub
Reply
Add comment
Helpful
+0
moins plus
Hi Adikademani,

You included the x within the path string. Since it is a variable you need to place it outside like:
"G:\PEP\04.Kaizen\KAIZEN Audit\02 Auditfragebögen\5S questionaire\" & x)

Also make sure that you enter the full file name (so with extention) when prompted by the inputbox for the code you created.

Best regards,
Trowa

AdiK- Nov 9, 2016 02:44PM
Thanks a lott :)
Reply
Add comment

Member requests are more likely to be responded to.

Members can monitor the statuses of their requests from their account pages.

A CCM membership gives you access to additional options.

Not a member yet?

Sign up now. It takes less than a minute and is completely free!