Copy images from one worksheet to multiple worksheets

jugodefrutas

New Member
Joined
Nov 23, 2017
Messages
1
Hello,

I have three worksheets, one containing many pictures called "Picture 1, Picture 2, Picture 3...", another with all the data and the last one should hold part of the data with the corresponding picture. So far, I've managed to import data from one worksheet to the other, but I'm having trouble with the pictures.

The code is supposed to grab the data belonging to one single room of the building (I'm an architect), and select the picture of the layout of said room and create a new worksheet in which there's only the data belonging to that room and the corresponding picture. What I've managed so far is to create a new worksheet each time and import the corresponding data, but I can't do the same with the pictures.

Here's the code I've been using:

Sub raumbuch()


Dim i


For i = 1 To 564
Sheets(3).Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = i
Range("$B$1").Value = Range("$B$1").Value + 1




Next
End Sub

564 is the number of rooms in the building and therefore the amount of worksheets that I need. The room data is bound with macros to the cell B1, so I only need to change that cell in order to get the corresponding data for each room. Anyway, I've been trying many things but none of them work. This is my actual stand:


Sub raumbuch()


Dim i As Integer, x As Integer, pic As shape


For i = 1 To 564
x = 8


Sheets(3).Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = i


For Each pic In ActiveSheet.Shapes
If pic.Type = msoPicture Then
pic.Delete
End If
Exit For
Next pic


Worksheets("UG 2").Shapes("Picture 2").Copy
Worksheets(x).Paste Range("A13")


Range("$B$1").Value = Range("$B$1").Value + 1


x = x + 1


Next i
End Sub



I don't know how I can tell the program that I also need to change the picture with each new worksheet. Also, as my understanding goes, I need to first delete the picture that comes with the copied worksheet, and then paste the new image, which I tried but failed horribly.

All the help is appreciated!
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
From the way I read this you want to make 564 copies of sheet (3)
Not sure what you want this to do:
Range("$B$1").Value = Range("$B$1").Value + 1

Do you want Range("B1") to be the same as the sheet name?

And lets give these sheets you already have some names for us to work with.
You said:
I have three worksheets
Tell us the names of these sheets. It's better to give these sheets some names we can work with instead of saying sheet 1 sheet 2 sheet 3

So you can then say make 546 copies of sheet "Master" and copy pictures from sheet named "Pictures"
And get data about pictures from sheet named "Picture Data"

As far as having to delete picture before copying picture to another sheet I do not believe is needed.

But depending on how large these pictures are we may need to do that. We may want to do this 100 at a time if we run into memory problems.

And all these new sheets we are making. I would think it would be better to give them better names then just i Maybe something like Room1 and then Room 2 etc.



And then in your second script your wanting to make another 564 copies of sheet(3)
And enter pictures.

But you have given this second 564 sheets the same names as the first 564 which will now create duplicate named sheets which is not allowed.


Can I assume you want to make 564 copies of Sheet(3) and then place Picture 1 into sheet named "1"
And put picture "2" into sheet named "2"

And each picture will be put into Range("A13") on it's sheet.

Answer all these questions for me and maybe I can help you.
Please check back in here at least daily if you want help on this.
Some users ask a question and then wait a week to see if there is a answer here.
That then can take both of us a long time if we have more questions.
 
Upvote 0
And when you say this:
and the last one should hold part of the data with the corresponding picture

I'm assuming some text must be associated with each picture.

So if we copy picture named "Picture 1) and paste it on to sheet named "Room 1")
and paste the picture into Range ("A13")

How do we know what text on sheet named "Picture Data" goes into sheet named "Room 1"

And where on the sheet will this data be entered.
I know how to do all this if you can answer these questions.
 
Upvote 0
You have also posted this same question here: This is called cross posting and when you do this forum rules say you need to tell us this:
So now we have several people on more then one forum trying to answer your question. And I asked several questions but have received no answers.

Cross posted here:
https://www.excelforum.com/excel-pr...rom-one-worksheet-to-multiple-worksheets.html




Hello,

I have three worksheets, one containing many pictures called "Picture 1, Picture 2, Picture 3...", another with all the data and the last one should hold part of the data with the corresponding picture. So far, I've managed to import data from one worksheet to the other, but I'm having trouble with the pictures.

The code is supposed to grab the data belonging to one single room of the building (I'm an architect), and select the picture of the layout of said room and create a new worksheet in which there's only the data belonging to that room and the corresponding picture. What I've managed so far is to create a new worksheet each time and import the corresponding data, but I can't do the same with the pictures.

Here's the code I've been using:

Sub raumbuch()


Dim i


For i = 1 To 564
Sheets(3).Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = i
Range("$B$1").Value = Range("$B$1").Value + 1




Next
End Sub

564 is the number of rooms in the building and therefore the amount of worksheets that I need. The room data is bound with macros to the cell B1, so I only need to change that cell in order to get the corresponding data for each room. Anyway, I've been trying many things but none of them work. This is my actual stand:


Sub raumbuch()


Dim i As Integer, x As Integer, pic As shape


For i = 1 To 564
x = 8


Sheets(3).Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = i


For Each pic In ActiveSheet.Shapes
If pic.Type = msoPicture Then
pic.Delete
End If
Exit For
Next pic


Worksheets("UG 2").Shapes("Picture 2").Copy
Worksheets(x).Paste Range("A13")


Range("$B$1").Value = Range("$B$1").Value + 1


x = x + 1


Next i
End Sub



I don't know how I can tell the program that I also need to change the picture with each new worksheet. Also, as my understanding goes, I need to first delete the picture that comes with the copied worksheet, and then paste the new image, which I tried but failed horribly.

All the help is appreciated!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

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