Excel Challenge

jwindholz2725

Board Regular
Joined
Sep 20, 2011
Messages
94
I'm sure it is possible but have no idea where to begin. Trying to make a long story short, we will pull a sheet into our workbook and then create tabs based on the data in the workbook. The format is consistant. I would like to read from the sheet we import. For example I would like to take the names from say A1:A40 from the imported sheet (for reference the tab is named WBS) and have excel create tabs off those names. So if the names in A1:A40 (of the WBS tab) are 1,2,3...40. Excel would create tabs named 1,2,3..40.

So I know the code would need to take data A1:A40 in the WBS tab, and then create a tab for cell A1, A2...A40.

Is this possible??
 
Lightly tested...

Code:
Option Explicit

Sub doCopies()
    Dim DestWB As Workbook: Set DestWB = ActiveWorkbook
    Dim UserChoice
    UserChoice = Application.GetOpenFilename(, , _
        "Please select the source workbook from which to copy sheets 1 and 3")
    If TypeName(UserChoice) = "Boolean" Then Exit Sub
    Dim SrcWB As Workbook
    Set SrcWB = Application.Workbooks.Open(UserChoice)
    SrcWB.Worksheets(Array(1, 3)).Copy before:=DestWB.Sheets(1)
    SrcWB.Close SaveChanges:=False
    End Sub


OK, I will definitely do that in the future, thanks for setting me straight.

Yes, the 1st and 3rd sheets of workbook 2 is what I want to import, and they will always be sheets 1 & 2 in the workbook I want to import them to.
How I really want it set up is as follows.

Open workbook 1 (the one I want to import TO) and have a macro button on page 1 of that workbook that would ask where to find the workbook (2) I want to import FROM. Then auto import sheets 1 & 3 from the chosen file as sheets 1 & 2 in my workbook.
'
The name of workbook 1 will be 'Schem Timesaver' (with a revision suffix xxx) and the name of workbook 2 can vary but will always be chosen by whomever is using the file.
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
:oops:.....Maybe got a little to ****y to soon. What we did works perfect.

I thought it would be a simple =sign in the destination cells that would import the data I wanted but it's not.

What I want to accomplish from this point is to have cells on sheet 1 of the workbook I am importing TO be populated from cells on sheets 1&2 of the workbook I am importing FROM automatically.
I tried referencing a cell of the imported sheet on sheet 1 of the workbook I am importing to, prior to importing, but it doesn't copy over. Any idea how I might make the data copy over after importing?
 
Upvote 0

Forum statistics

Threads
1,225,156
Messages
6,183,240
Members
453,152
Latest member
ChrisMd

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