I have a Excel workbook with two sheets - 'MainDataSheet' and 'ArchiveSheet' .
The 'MainDataSheet' has 5 columns and one of the column is 'status'.
The 'MainDataSheet' will have a command button 'MoveData' which will trigger the VBA macro to move data rows from 'MainDataSheet' to 'ArchiveSheet' . Only the rows having value set to "MOVE" in the 'status' column have to be moved.
I have a set of worksheets that need to be moved to their own individual master sheets. i.e. FW32Lightning.csv needs to be moved to Lightning.xls which has all of the fiscal weeks in it as seperate. I know the generic way of doing this, but I need to know how do I write the macro that when I run it every week I don't have to go in and change the fiscal week.
I need to be able to copy a worksheet from my ActiveWorkbook into a new workbook and save that new workbook. No problem doing that, the following code does it:
Code:
Dim wb As Workbook Worksheets("Alpha").Copy Set wb = ActiveWorkbook wb.SaveAs "Master.xls" wb.Close
Where I am running into the problem is I am needing to copy the 2nd worksheet form about 10 different workbooks into this same workbook.
1. I receive a weekly report 'Over Due Orders_1_14_08.xls' for example. This is sent every Monday and there is a Worksheet on this report called Raw Data.
2. I want to copy Raw Data from that Workbook but the name of the report changes w/ every Monday's date.
Any way of doing this - like just looking for "over due orders" in the Workbook name?
I need a macro that will take each worksheet in my file & create a new workbook for each. The new workbook name will need to be the original worksheet name. The number of worksheets & the worksheet names will very each time I run this code.
I have an external .xls file I'd like to copy to a new directory from within VBA. I know how to create the directory, but is there a way to do it other than opening the required file, and doing the " saveas" thing?
I have to report on 6 departments each with 6 sub departments weekly. First I need to consolidate 6 ( move/copy worksheet to consolidated workbook using a macro) separate worksheets (all saved in the same folder) per department into single workbook (preferably generated automatically by macro/code). I then need to repeat the above process for another 6 files per sub department. The output files should be pasted as "values" while retaining all other formatting. In essence I need to automate the whole right click on tab, select move or copy worksheet function in excel to take the load out of doing it manually.
I have a workbook that contains 50 worksheets named 1-50. I need to add more worksheets. all the formulas in the worksheets always refers to the previous worksheet.
How can i make a copy of the worksheet named 50, name it 51 and have all the formulas in worksheet 51 refer back to worksheet 50?
In versions prior to Excel 2007, I was always able to copy a chart when I copied a tab. However, when I copy a tab in 2007, the data copies fine, but the chart does not. Something similar happens when I try to move a tab with a chart on it to another workbook.
I have a Reporting workbook I designed. There is a "Parent" workbook with the following design.
It has 6 Pivot Tables on a Sheet called "Data"
It has 6 Pivot Charts that were created from these tables on a page called "Summary"
These 6 Pivot Charts are all linked through a pair of slicers.
There is a "control" page which has instructions and buttons that trigger "Refresh All" and "Create Child Workbok".
This design is so that someone unfamiliar with excel could conceivably create the final product.
Essentially I have written/put together VBA to Create a new workbook "child" which has should be a funcitoning copy of the "parent".
The problem is the copiedmoved (I have tried both) Pivot Charts no longer update/refresh when the pivot tables change. I have script that reconnects the Pivot Tables to the Slicers. Slicers are fully funcitonal. Links in cells are fully functional.
Some of this code might look familiar.
Code:
Sub createWB() ' Copies VBA modules, Calls Dim wbNew As Workbook, wbT As Workbook Set wbT = ActiveWorkbook On Error Resume Next Kill ("PATHmod1.bas") Kill ("PATHmod2.bas")
I have code that i use to copy a worksheet of information in one workbook to a worksheet in another workbook. All i need is some guidance on how to copy a second worksheet from workbook 1 to a second worksheet in workbook 2. Should be fairl straight forward.
In the below i am copying the sheet Phone_data to a second work book sheet also called Phone_Data, i would like to include in the same proccess a sheet called Sur_Data from workbook 1 copy to a sheet called Sur_Data_R in the second. All the other features like find next empty row also apply.
I have an open workbook (A) and this is where the code should reside. I want to use VBA to copy the content of an entire worksheet from a closed workbook (B) to an existing worksheet in workbook A. How would you accomplish this?
I am looking for a code that would copy the data from each worksheet in a given workbook and then paste to just one worksheet within a different workbook. The Sheet names are auto generated when I run this canned report but the naming structure is always the same...the first worksheet is named Repair Details and then the next sheet is named Repair Details_1, the next sheet is named Repair Details_2 and so on for every sheet in workbook. So I would like to copy all of the data(Headers to last cell) and then paste in a worksheet(ex: Master Repair Report.xlsx and the worksheet could be titled Master Repair Details) on a different workbook, then the next sheet would copy from the one under the header to the last record and paste to the same workbook. This process would repeat for every worksheet in the Repair Details Workbook and paste to Master Repair Details worksheet in the Master Repair Report workbook.
I need to copy a range of values (actually two ranges). The ranges are of fixed size. Le't say A2:D20 and E2:H20.
Both workbooks have the exact same layout, and they both have the same named worksheet (in this case it's called Entry). However the actual filename of the source workbook is unknown. I know numerous users have changed the filename of the xls file.
I want to instruct them to open the old and new workbook, and open a third workbook containing the copy macro, they run the macro and it copies the data.
How can I reference a known worksheet name but of an unknown workbook name esp when the source and destination share the worksheet name?
I am trying to copy one worksheet using the "move/copy" function that is available when you right click a tab name and want to copy the worksheet in the same workbook
The steps I'm using are:
1. Right click the tab name 2. Select Move or Copy, 3. Select Create a Copy 4. Click OK
Doing all of the above does not work. When the new worksheet opens, all columns are the same width. It seems to be stuck on "autofit column width" setting of 8.5. The original worksheet is several columns wide all with different width settings.
I've also used Copy, Paste Special and selected column widths and that does not work either.
I have been struggling with trying to find a way to copy worksheets from one workbook to another. The workbooks change each month. As I was searching the forum for previous threads on this topic, I found this great code, but I need to modify it just a bit and I do not know how to do that. The code allows the user to select the worksheet to import, but it imports it to a new workbook and I need to be able to not only select the sheet to import, but the workbook to import it to.
Though VBA I am trying to copy one worksheet into a new workbook. This worksheet contains Graphs which point to other datasheets in the same workbook.
I first copy the data worksheets, then I copy over the worksheet with graphs. However the graphs link to the original worksheet name- not to the datasheets in the same workbook as the newly created workbook. This is a problem since I am going to send this other workbook to users and they won't have access to the orginal datasheet.
I copy the sheets using the code:
Set wsheet = inbook.Sheets("Division") wsheet.Copy after:=gobjOutBook.Sheets("Executive Summary")
Where the worksheet DIVISION is the worksheet containing the graphs and the data sheets are already copied there.
The macro below copies certain sheets from one workbook to another, however the worksheets are protected in the original but when they are copied to the new workbook the protection is removed. Is there any way to keep them protected once copied?
I also have a couple of buttons with macros assigned to them one of which I would like to remove when the worksheets are copied to the new workbook, is this possible?
Code: Sub REN_REPEAT() ' Rename
Dim myName As String 'Copies the sheets to a new workbook: Sheets(Array("NEW_ORDER_", "CP_NOTES", "DATA")).Copy
I am trying to copy a worksheet called "Survey Extract Agents" from one workbook into another called "Raw Test Data". "Raw Test Data" is also the name of the sheet in the workbook of the same name. I want the "Survey Extract Agents" to be inserted after the "Raw Test Data" sheet. My macro keeps choking on it....
I need to come up with a macro code to copy 2 worksheet from 2 workbooks to my current workbook. I do not know what is the code such that i can copy different worksheets from other workbooks to a currently opened workbook.
Below is the scenerio i want to achieve:
worksheet1 from workbook1 need to be copied and paste as a worksheet in workbook3. worksheet1 from workbook2 need to be copied and paste as a worksheet in workbook3. workbooks will eventually contain 2 worksheets which are from workbook1 & 2.
I am trying to use a routine that I copied from another thread on this forum, but I get an error message: Runtime error "1004" Copy method of worksheet failed.
How to copy the entire worksheet into a new workbook and save the file to a specific directory with the following filename format ("exceptions191011 - ie. the word exceptions followed by today's date in ddmmyy format).
How to add the following condition that if a file already exists with that name then to bring up an error message stating the file already exists? As well as save the new workbook, it appears to close the original workbook - can I stop this?