2007 Macro : Inserting Pictures
Nov 24, 2008
I had a macro that worked perfectly by inserting pictures into named ranges throughout the sheet depending on user input. However when I switched to Microsoft Excel 2007, the pictures all go into one cell.
My code looks like this:
Application.ScreenUpdating = False
Dim picnme As String
Dim rng As Range
Dim ArrImg
Set rng = Range("B5")
picnme = Range("B5")
picnme = Range("B5")
Range("B5").Select
ActiveSheet.Pictures.Insert( _
"C:ArchivePictures" & picnme & ".jpg").Select
Selection.ShapeRange.ScaleWidth 1.1, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 1.1, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.IncrementTop 1.5
Selection.ShapeRange.ScaleWidth 0.84, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 0.95, msoFalse, msoScaleFromTopLeft
I only copied in a section of it bit it gets rather repetitive. There are over 50 pictures that get inserted into the spreadsheet and it worked fine in the prior version of excel.
View 9 Replies
ADVERTISEMENT
Mar 17, 2009
I am having some trouble with the vba code I'm using to reference pictures. Now please bear with me, I'm don't know vba whatsoever and am copy/pasting what I found on the internet.
The spreadsheet in question is attached....
The issue:
I am trying to show a picture based on the inputs in the cells above. Basically the picture in cell A28 is referenced by the information in cell AI7. The picture in cell D28 should be referenced by the information in cell AI8 and so on.
The problem is that when I enter the code to insert multiple pictures, it comes up with errors.
I'm hoping this is just my lack of programming knowledge and this is an easy fix. Please tell me where I am going wrong.
Also, will there be an issue if I reference the same picture multiple times?
View 6 Replies
View Related
Apr 30, 2009
I have written some code to insert pictures into shapes as part of a facility management problem I have.
Code takes the names from a list of pictures (ConditionList) and places each one into a corresponding shape - therefore populating a report on the facility.
Works to the point of inserting the pictures OK but if I refresh the ConditionList by adding or deleting pictures, my shapes dont refresh.
Sub ConditionPics()
Dim ConditionListCount As Integer
Dim ShapesCount As Integer
Dim ConditionList As Range
On Error Resume Next
Application.EnableEvents = False
View 9 Replies
View Related
Jun 11, 2014
write a code to insert and auto adjust multiple pictures in a sheet with address of the pictures are in a column, You can download the sheet from below link for details.
Insert Pic - Download - 4shared.
View 3 Replies
View Related
Nov 21, 2007
I want to be able to a place a picture on a workbook based on a cell. In column A, I will run a sql query to pull a list of items. In column B, I have the items formated thus they have a the .jpg. next to item of the picture i.e Hammer.jpg. whereas column A lists Hammer and Column B Hammer.jpg. In column C, I would like the pictures to reside in this column.
So far I have this macro but I can only get two pictures to come up even though my list has 4 items on it.
Sub pic()
Dim x, c, d, a As Long
d = 2
c = 40
For a = 2 To 6
b = Cells(a, 2)
View 9 Replies
View Related
Dec 19, 2012
How do I insert pictures into Excel's cells, so as to get a mosaic of say 2x3 pics?
Trying to just drag a pic onto a cell does not make the pic sticks. I need the pics to behave like in frames in HTML, including moving, resizing etc. Same for video clips that I want running within the cells.
View 4 Replies
View Related
Jan 2, 2013
What will show in column B will change each day as a I am creating a ordering picking list and want to show a pic in column A of the item to pick the item. Is there an easy way of doing this.
I have been messing around with the following
=showpic("C:DesktopItems46004978Thumb.jpg")
And thought I may be able to show this as by doing the following in the desired cells
=IF(ISBLANK(B1),"",INDEX(Sheet1!A:A,MATCH(B1,Sheet1!B:B,0)))
On sheet1 I have all the model numbers next to
=showpic("C:DesktopItems46004978Thumb.jpg")
And the index formula will grab the correct showpic string depending on stock code that is showing in various column B cells but this isn't working.....
View 9 Replies
View Related
Dec 12, 2013
Macro that would insert multiple pictures at once into one column with two rows per page (so that only two pictures are on each page) for word?
If so, would there also be a way to make it to were photos would have a caption box underneath each photo that list them as "Photo #1: Photo #2: Photo#3:" ect...
I know this is quite a task to achieve but I'm still relatively new to Macros and VBA and have a ton of pictures to integrate into Word for work.
View 1 Replies
View Related
Jun 23, 2003
I now have this code that inserts a picture and then resizes it the active cell shape.
Sub InsertPicture()
Dim myPicture As String
myPicture = Application.GetOpenFilename _
("Pictures (*.gif; *.jpg; *.bmp; *.tif),*.gif; *.jpg; *.bmp; *.tif", , "Select Picture to Import")
If myPicture "" Then
ActiveSheet.Pictures.Insert (myPicture)
ActiveSheet.Shapes(ActiveSheet.Shapes.Count).Select
With Selection
.ShapeRange.LockAspectRatio = msoFalse
.ShapeRange.Height = ActiveCell.RowHeight
.ShapeRange.Width = ActiveCell.Width
.Placement = xlMoveAndSize
End With
End If
End Sub
View 9 Replies
View Related
Jun 26, 2008
I am working on transfering some code from 2003 to 2007. I have gotten almost everything to work, but am now having an issue with the way it places the pictures into my spreadsheet.
The code asks the user to select a folder containing .jpg files. It then places each of the .jpg photos onto a single spreadsheet. Each picture is suppose to be placed in a different cell. When I step through the code, the active cell changes correctly based on the offsets, but it always pastes each photo in cell B4. Through some research I have found others to see this problem with ActiveSheet.Pictures.Insert in 2007.
Following is the
Private Sub BatchProcessThumb2x3()
Msg = "Select a file containing the photos you want to insert."
Directory = GetDirectory(Msg)
If Directory = "" Then Exit Sub
If Right(Directory, 1) "" Then Directory = Directory & ""
View 9 Replies
View Related
Apr 28, 2014
I have an workbook with pictures that are linked to external picture files, and they are placed in the workbook via macro. When I email the file to another computer and open it, the pics do not display and show an error:
The linked image cannot be displayed. The file may have been moved, renamed, or deleted, Verify that the link points to the correct file and location.
I would like to be able to save the workbook with the pictures in them (without having to archive them) so that I can open it and see them on another machine.
View 1 Replies
View Related
Dec 11, 2011
I am having difficulty writing code to insert a hyperlink from a command button on a userform.
I have set up a worksheet to be a data base for a lot of new files which are being created on a daily basis. The userform when activated asks the user to input certain information about the new file being stored in the data base (ie file name, date created, relevant project, description, who created it, etc). I have put a command button on the userform which I would like to activate the "Insert Hyperlink" menu so the user can then navigate to the location of the file being stored and have that hyperlink stored in a cell against the file when the "Submit" button is clicked on the userform.
I have read almost every thread on inserting hyperlinks with vba but none seem related to my needs. Using Windows 7 and Excel 2007
View 3 Replies
View Related
Feb 15, 2014
If Cell value in "C36" or "D36" is Yes, then a picture will be displayed (either Picture 1 or Picture 2). If Cell value is No, then the pictures won't be displayed.
The code I use:
[Code] .....
By default, all pictures on the Excel sheet are invisible.
My problem is, there are 3 pictures I'd like to display at all time because they are part of the document's decoration.
Therefore, I'd like to add an exception for the Picture A, Picture B, Picture C so they are not affected by the command "Me.Pictures.Visible = False".
View 3 Replies
View Related
Mar 5, 2013
I have a worksheet with four data columns A,B,C,D starting in row 2. I want to add between every row, exactly 11 blank rows. So if we have:
Code:
A B C D
1 5 3 4
2 7 6 3
3 9 1 3
the end result should be:
Code:
A B C D
1 5 3 4
2 7 6 3
3 9 1 3
Do I necessarily need a macro for this? Or is there another quick and creative way to achieve this result?
View 3 Replies
View Related
Nov 30, 2012
I'm using Excel 2007.
I'm building a spreadsheet which includes a few columns which have activex check boxes which are linked to cells. I want to allow the users of the spreadsheet to insert new rows if necessary. Ideally, when these new rows are inserted, the check boxes would also automatically appear in the corresponding columns of the new row (and be linked to the relevant cells), just the same way that pull-down menus and formulas automatically copy into the new row. Is there a way to do this?
View 1 Replies
View Related
Mar 16, 2009
I'm wanting to add a button on the last row of a worksheet to "add rows" above the buttion (entire row). I have some cells (6 total) that have a formula that needs to carry over to the newly created rows. Some cells remain blank but some cells need to have the formulas fill down to the new rows (i.e.: =sum(a2+1), =sum(a3+1)...
Is it possible to give option of choosing how many rows someone wants to insert?
Help in creating the button, option to choose # of rows and the macro to insert those rows.
View 12 Replies
View Related
Mar 5, 2012
Is it possible to insert for example Private sub Workbook_open() into This workbook by executing macro?
View 8 Replies
View Related
Oct 17, 2012
I have recorded a basic macro that allows me to copy a formulas in cells CF11 to CH11, and it pastes it into cells in columns CJ to CL. Copy of code is below if you need it.
The issue I have is that I need to insert new coumns into the worksheet, and I need to copy the formulas from columns CF to CH, and they will now need to pasted to columns CN to CP. Note that this is a monthly report where we keep the prior months, so each month will need to add new columns. There are 8 tabs in the workbook, and they all use the same macro, just over different rows (columns all line up).
Is there a way that I can get the macro to paste into the correct column without me having to adjust the macro each time?
Copy of code is as follows:
Range("CF11:CH11").Select
Selection.Copy
Range("CJ11").Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Range("CJ20:CL20").Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
[code].....
View 5 Replies
View Related
Dec 22, 2006
simple little procedure to insert columns on two sheets and call each by the same name. Macro runs off a command button and inserts a column at E:E and gives the user an input box with which to name the inserted columns.
Code: ...
View 9 Replies
View Related
Aug 8, 2006
I need to insert a new row, in a spreadsheet, after every ninth row that now exists. How is this easiest done?
View 3 Replies
View Related
Feb 14, 2007
How can i make a macro that inserts todays date, tomorrows date, the next day and the day after that??
View 2 Replies
View Related
Feb 23, 2009
see the attachment. You will see that I have recorded two macros:
1) To insert a new row for new people.
2) To insert a row for new animals.
With regards to 1), I would like to create a macro that copies the contents of the row with the penultimate name in the people section, and for a new row to be inserted beneath the copied cell. Similarly, with regards to 2) I would like to create a macro that copies the contents of the row with the penultimate name in the animal section, and for a new row to be inserted beneath the copied cell.
The issue that I have is that the macros do not copy the penultimate cell in each section, but copy a particular row, say row 11 each time I want to insert a new animal. So if I had inserted numerous new rows for the people section, and subsequently wanted to insert a new row for the animal section, I press “crtl+sht+a” which copies the contents of row 11 and which is not the contents of the penultimate row for the animal section.
View 2 Replies
View Related
Feb 24, 2009
I have two sections to this spreadsheet: 1) the entity section; 2) the order section.
I have created a macro to insert rows in both these sections. The macro appears to work fine for the first section but not for the second section. The problem I cannot solve is in respect of cells D9:D10. The macro is as follows:
View 6 Replies
View Related
Mar 18, 2009
I'm trying to write a macro that inserts multiple rows by giving user a MsgBox to enter the # of desired rows. Meanwhile, I need to make sure that the formulas in certain cells are filled down (not just copied from cell directly above). I put something together but it's only adding a single row. Attached is my sample workbook.
View 2 Replies
View Related
Sep 30, 2009
I am trying to create a macro that will create a comma and space between every 5th character within a cell. that would be preference #1. What I decided to go with for now, instead, is to try (using the macro recorder) text to columns, fixed width, and do this after every 5th character, and selecting each cell to be formatted as text.
What I am having difficulties with is trying to tell the macro which cells to touch and which ones not to. I do not want the macro to do text to columns and fixed width on simple text. I only want it to do the macro when it is a string of numbers that, during transfer from PDF to excel, have been concatenated into one cell. I also want the macro to do this for infinite number of rows. I have excel 2007.
I am attaching a small excel file with examples of data I am working with. I have saved this excel file as a 97-2003 version for those who do not have 2007. As I stated, if anybody can help me figure out how to do a simple insert comma space every 5th character where information has been concatenated, that would be preference. Also, I am not trying to change anything within column A. Only column B. On the sample file please note B3 - B6. Rows 5 & 6 are fine as they are. Other problem rows include B11 - B13
View 2 Replies
View Related
Oct 19, 2009
I would like to create a macro that will automatically insert a page break based on the contents of the cell.
A1:A4 = has value
A5 = BLANK
A6:A14 = has value
A15 = BLANK
and so on....
I would like to put a page break in A5 and A15....and for those cells that are blanks.
View 11 Replies
View Related
Mar 21, 2008
Just a quick on i hope. Im trying to create a macro that adds a worksheet/tab and Rename it to the month after the tab already showing.
e.g
if i already have two tabs one dated january and the other named february i require the macro to say march then the next run would be april if you get my drift.
View 6 Replies
View Related
Jun 18, 2008
I have a bit of code which performs correctly but it ONLY works if it is pasted into the worksheet using VBA. I currently have to manually copy/paste it before it will work and I am needing a macro to handle inserting this for me.
how to get a macro to copy/paste into Sheet1 under the VBAProjects heading?
View 9 Replies
View Related
Jul 3, 2008
I have a VBA macro I recorded that won't insert and copy columns into the proper areas. When I run this, It inserts every column all grouped together.
For example: I want to insert a column before column D, and give certain cells formulas. Instead, it inserts it before column C. The whole macro seems to, when ran, insert EVERYTHING before the range of data I am trying to split up.
Here is the
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 6/30/2008 by kmayfield
'
'
Range("C3:F3").Select
ActiveCell.FormulaR1C1 = "Jan-2008"
Range("G3:J3").Select
ActiveCell.FormulaR1C1 = "Feb-2008"
Range("K3:N3").Select
ActiveCell.FormulaR1C1 = "Mar-2008"
Range("O3:R3").Select
ActiveCell.FormulaR1C1 = "Apr-2008"
Range("S3:V3").Select
ActiveCell.FormulaR1C1 = "May-2008"
Range("W3:Z3").Select
View 9 Replies
View Related
Jun 22, 2007
in a certain macro, I generate graphs in different windows. At the end of the macro, I want to activate these windows one after the other putting a time delay in between. How can I do this? (I have found a "delay property" in the VBA help, but it only applies to forms...).
View 4 Replies
View Related