Creating Multiple Worksheets with Specific Data

reberryjr

Well-known Member
Joined
Mar 16, 2017
Messages
714
Office Version
  1. 365
Platform
  1. Windows
I receive a report every week that contains details about test scripts. Each week, I've been breaking out each individual script onto separate tabs entitled after the script. There are currently 50+ scripts. While not overly time consuming, it is annoying. I need help creating a script that:

1. Creates a new worksheet entitled script A
2. Copies script A data from the master worksheet and pastes it onto the script A worksheet

I've figured out how to create a worksheet named after each script ID, but I'm struggling with getting the data relevant to just that script.

Here's what I'm using to create the worksheets:
VBA Code:
Sub CreateSheets()

Dim rng As Range
Dim cell As Range

On Error GoTo ErrorHandling

Set rng = Application.InputBox(Prompt:="Select Cell Range:", Title:="Create Sheets", Default:=Selection.Address, Type:=8)

For Each cell In rng

If cell <> "" Then
    Sheets.Add.Name = cell
End If

Next cell

ErrorHandling:

End Sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
This may well be doable. BUT, without seeing what script-specific data looks like there isn't a way to assist. Specifically what script-specific data is copied to the worksheets as they are created? Presumably, there is a different script-data-specific range to copy for each worksheet created? Hopefully, there is a pattern to that. For example, script-specific data for script sheet #1 created is in range B1:B30, script-specific data for script sheet #2 created is in range C1:C30, etc.

Might you post a workbook that shows what is to be copied? Use the link icon above messages.

If nothing else try using Mr Excel's excellent add-in (XL2BB) that enables you to post a portion of a worksheet. See HERE.

Use XL2BB to show us 1. where (in which cells) script-specific worksheet names are located and 2. where data is located for at least a few of the script-specific worksheets created and what that data looks like.
 
Upvote 0
This may well be doable. BUT, without seeing what script-specific data looks like there isn't a way to assist. Specifically what script-specific data is copied to the worksheets as they are created? Presumably, there is a different script-data-specific range to copy for each worksheet created? Hopefully, there is a pattern to that. For example, script-specific data for script sheet #1 created is in range B1:B30, script-specific data for script sheet #2 created is in range C1:C30, etc.

Might you post a workbook that shows what is to be copied? Use the link icon above messages.

If nothing else try using Mr Excel's excellent add-in (XL2BB) that enables you to post a portion of a worksheet. See HERE.

Use XL2BB to show us 1. where (in which cells) script-specific worksheet names are located and 2. where data is located for at least a few of the script-specific worksheets created and what that data looks like.
Unfortunately, I'm not permitted to post an image of the current workbook structure (it's a work thing). Essentially, each script has a primary key in column A of a worksheet entitled "Inventory". The script I posted above will create a worksheet for each script using the aforementioned primary key. I simply want data from Inventory worksheet to copy and paste to the worksheet with the same name as the primary key.
 
Upvote 0
Without seeing data and locations involved it is unlikely that you'll get the assistance sought. Can you post fake but realistic data?

You say
each script has a primary key in column A of a worksheet entitled "Inventory"
Where does that data start? Cell A1? Is the data for "a key" in the same row as the key in column A?

Regarding
I simply want data from Inventory worksheet to copy and paste to the worksheet with the same name as the primary key.
Where in the new worksheet does data get pasted? Does key get pasted too?
 
Upvote 0

Forum statistics

Threads
1,223,905
Messages
6,175,297
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