Excel Picture Inserting Macro Help - Urgent
Solved/Closed
nadimn
Posts
3
Registration date
Tuesday April 27, 2010
Status
Member
Last seen
April 28, 2010
-
Apr 27, 2010 at 04:34 PM
jackcluseau - Dec 4, 2014 at 11:26 PM
jackcluseau - Dec 4, 2014 at 11:26 PM
Related:
- Macro insert picture excel
- How to insert picture in word without moving text - Guide
- Insert gif in excel - Guide
- Spell number in excel without macro - Guide
- Convert picture to shape powerpoint - Guide
- Insert check mark in word - Guide
1 response
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Apr 27, 2010 at 10:15 PM
Apr 27, 2010 at 10:15 PM
Try this. New lines are highlighted
Sub Picture() Dim picname As String Dim pasteAt As Integer Dim lThisRow As Long lThisRow = 2 Do While (Cells(lThisRow, 2) <> "") pasteAt = lThisRow Cells(pasteAt, 1).Select 'This is where picture will be inserted picname = Cells(lThisRow, 2) 'This is the picture name present = Dir("C:\Users\Administrator\Desktop\LC\" & picname & ".jpg") If present <> "" Then ActiveSheet.Pictures.Insert("C:\Users\Administrator\Desktop\LC\" & picname & ".jpg").Select 'Path to where pictures are stored ''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' This resizes the picture ''''''''''''''''''''''''''''''''''''''''''''''''''''''' With Selection '.Left = Range("A6").Left '.Top = Range("A6").Top .Left = Cells(pasteAt, 1).Left .Top = Cells(pasteAt, 1).Top .ShapeRange.LockAspectRatio = msoFalse .ShapeRange.Height = 100# .ShapeRange.Width = 130# .ShapeRange.Rotation = 0# End With Else Cells(pasteAt, 1) = "No Picture Found" End If lThisRow = lThisRow + 1 Loop Range("A10").Select Application.ScreenUpdating = True Exit Sub ErrNoPhoto: MsgBox "Unable to Find Photo" 'Shows message box if picture not found Exit Sub Range("B20").Select End Sub
Apr 27, 2010 at 11:20 PM
thank you so much for the help. BUT still there is problem
when I m running this new macro, it pastes pictures and pastes "no picture found" only in first possible cell then it get stuck.both excel visual basic editor get hangs and u can not do anything after that. In task manager it doesnt show not responding thing to excel it shows normal running but actually it is jam..
may be little tweaking here n there required
your m waiting 4 ur quick reply again..
thankyou
Apr 28, 2010 at 06:03 AM
lThisRow = lThisRow + 1
was not at right place. Try now