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!
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!