Macro to copy and populate an egsisting ssheet and save it.

T

Tim

Hi everybody,
I have a spreadsheet (Spreadsheet A) with a table in it having different
data like this:

Schematic 1 200 210 205
Schematic 2 160 200 300

There are about 300 rows and 20 columns in that table.
I also have a second spreadsheet (Spreadsheet B) with a simple schematic in
it.

What I want to do is:
1: To populate some certain cells in Spreadsheet B (where the schematic is)
based on the data of the first row in the table (200, 210, 205……)
2: rename and save this spreadsheet (either separately or as a new sheet in
the same workbook) with the value/name given in the first cell of the first
row.
3: repeat the procedure for the next row.

Let me know if smth unclear.

Can you also please answer in Macro for dummies as I can record a macro,
maybe change some code in it but than that’s it.

Many many many thanks
 
T

Tim

Ok, I just experimented with a code which copies the sheet "schematic" in the
same workbook and renames it based on values found in the "Table" spreadsheet.
What I want still to do, is to populate certain cells in the newly created
sheet with cell values taken from the same row as the name, in the table
sheet. Below is the code that I wrote so far:

Sub Copy_Sheets()

Dim i As Integer
Dim wks As Worksheet

Set wks = Sheets("Table")

For i = 3 To 250
Sheets("Schematic").Copy after:=Sheets(2)
ActiveSheet.Name = wks.Cells(i, 1)
ActiveSheet.Cells(1, 2) = wks.Cells(i, 1)
Next

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top