Copy And Paste Value Macro / Save Individual File To Right Of Specific Tab
Mar 25, 2013
I have a current macro that saves each sheet as their own file. The first 10-15 sheets are not really necessary, so I typically delete them once the macro has run. I am looking to add two things to my current code:
1. Add a tab called Start. Make the macro look for 'Start' tab and then just save each sheet to the right of that as its own file.
2. Save each sheet in the macro as just a copy/paste value. They current have a lot of links and it makes each file close to 3MB. That makes it incredibily difficult to paste all in one email.
Here is the current code:
'Creates an individual workbook for each worksheet in the active workbook.
Dim wbDest As Workbook
Dim wbSource As Workbook
Dim sht As Object
Dim strSavePath As String
On Error GoTo ErrorHandler
I have a macro that transfers (copy/paste) information from one master file to several other individual files. The macro works, but I would like to enhance it by have it spit out errors in the process as follows: if cell A42 on file VP1.xls is not equal to Cell C35 on file Masterfile.xls then make cell E2 ERROR and fomat E2 bold-red, otherwise do nothing. The macro should continue regardless, I just want it to spot errors. I think this is pretty simple is just a matter of inserting an IF formula in the macro which is something i don't know how to do yet.
Feedback.xls is the file I want to have my macro run in. By pushing a button to run the macro, it will prompt the user to select where their file is on their computer. This file will have different file names based on the end user. For example sake, I've included CAP.xls.
After the user selects their file, it will prompt them to choose which tab to copy and paste data from. Typically, there will be 30+ tabs on their worksheet. For example sake, I've created 5 tabs on CAP.xls. The tabs in their workbook will be labeled as I have labeled mine, M1 CAP, M2 CAP & M3 CAP. Therefore, it should prompt the user to select which tab to choose from.
After the user selects their tab (M1 CAP, M2 CAP, M3 CAP), the macro should prompt the user to choose which row of information to copy. In CAP.xls, I have a few rows of information to choose from. They all start with FY10A1, FY10A2, FY10A3, but this information could change. Once they select the row, it will copy each of those fields onto the respectively labeled fields on Feedback.xls.
The idea was to save the the selected files specified in the array as individual files. For example, In the Workbook "Main", there are worksheets "Susan", "Mary" and "John". If i specify "Susan" and "Mary" in the array, it should output only these 2 individual files. However, I am only getting the file which is actively selcted in the main. Is there anything wrong with the for loop?
Sub SaveShtsAsBook() Dim Sheet As Worksheet, SheetName$, MyFilePath$, N& Dim ws As Worksheet MyFilePath$ = ActiveWorkbook.Path & "" & _ Left(ThisWorkbook. Name, Len(ThisWorkbook.Name) - 4) With Application . ScreenUpdating = False .DisplayAlerts = False ' End With On Error Resume Next '<< a folder exists MkDir MyFilePath '<< create a folder For Each ws In Worksheets(Array("Mary", "Susan")) SheetName = ActiveSheet.Name Cells.Copy..............................
I want a macro that will save a copy of the current file using specific naming convention. My file is called OTR2CMMASTER - I want the macro to save a copy as OTR2CMSAGE(CURRENTMONTH/YEAR). The OTR2 is a named field (ProjectCode) in the workbook.
i have about 80 files that all have the same structure. I also have a general excel file that I need to fill with values from each of the 80 files. I'd like to use a macro that can be applied to each of the 80 files at a time (or at the same time, if that's possible) so I can copy the cells (only the text, not the formula) I need from each individual file to the general sheet.
e.g., each file is:
xyz 123 abc 456 ghi 956
I need to copy the "123" to a cell in the general sheet, "456" to a different cell in the general sheet and so on (to be able to choose which cell in the general sheet I am copying to).
This Macro is supposed to get certain totals for me from diffrent pages. Instead of selecting an entire row I want to select specific cells, so when it finds the word total on the sheet, whose location can change often it will return the value two cells away.
I already have code that I believe is supposed to do what I'm trying to accomplish. However, it doesn't fully work. The Macro is below:
VB: Workbooks.Open Filename:="C:Documents and Settingsplp138DesktopExample 1.xls" On Error Resume Next With Workbooks("Example 2.xls")[code]....
Basically, what I'm trying to accomplish is to have a certain range from one file copied, and pasted in the next available (empty) row of another file. While debugging I see that everything is working except for the actual pasting.
My problem is as such; each month I receive an application for payment. This will contain around 20-30 worksheets. However I only need to interrogate around 3-4 specific ones. The worksheets I require contain data describing the plant/equipment a company has purchased, or materials purchased over a period of time. Each month the worksheets are updated with the previous months data appended to the bottom. I am required to established if the equipments have been purchased at the correct rate.
The worksheets are all protected thus in order to interrogate them I am required to copy an paste their contents into a new work book in order to format them and insert my new "assessment" columns. I need to keep the work sheets separate in the new work book as they have different layouts however they have the same layout and work sheet names each month.
I needs a macro which would allow me to open up a new book them copy the specific worksheets from a specific file into the new work book. I then have a separate macro which re-formats them into the layout I require.
There's one sheet that has a list of customers (this is updated very frequently). These customers are either ‘New’ or ‘Existing (as listed in a corresponding column) - would it be possible to have a macro that, when run, will place a copy of existing customers into a second worksheet (“view list – new”), and a copy of new customers into a third worksheet (“view list – existing”), with the main worksheet still listing both existing and new customers.
As the main sheet that lists all customers is updated very frequently (with customers being added and removed throughout the day), would it be possible to clear all contents of the other two sheets that each list of 'existing' and 'new' customers will be copied into, before the two lists are copied into each of the two sheets (just to ensure there isn’t any data in there from the previous time each list was copied in).
I’ve given this a go via the ‘record macro’ function - some users of this WB use excel 2000, and others use excel 2007, but it only seems to work on excel 2007 (which is what it was recorded on)…
I have about 10 rows of data that have columns of information describing computer hardware and pricing. There are 10 rows, because each row represents a different country and different tax rates and pricing changes per country. So each column of a row has a specific formula to calculate information for that row's country information. All these 10 rows of formulas are kept as a reference at the bottom of the sheet.
At the top of the sheet I need to have a drop down menu to choose a country and then it will automatically copy and paste the row of that country to the current row at the top.
Is there any easy copy/paste macro for such a thing?
I have a macro which opens two different hyperlinks in excel. Opened workbooks have are named like 1.asp and 2.asp. Both contains only one spreedsheet. I need to copy these spreedsheets to the Workbook, from which they are opened.
I have a workbook that contains worksheets. They are listed as follows:
In cells A1 - A49 I have text. What I would like to do is to have a macro that I can run that will basically copy and save new workbooks with sheets A - G copied over and have the new workbook saved with the file name that I have denoted in cells A1 - A49 on Sheet 1. Also, the macro would ask me where I want to save the new Workbooks.
For example, if this were Sheet 1, Column A then the cells below would be the saved name of the new workbooks and the new workbooks would have Sheets A - G in themRed
One more piece of information, the file that is being copied and saved is large (~80MB). If there is a macro that would allow me to simply "save as' the workbook and the Saved Workbooks would be named using the data in Sheet 1, that would work as well in case copying, pasting, then saving may take more time
the above information have following header ie. Location, P.O.Box, Address, Tel, Fax and Category.
every time one of the header inforamtion is missing ie. Address or P.O.Box, Or Fax, due to this problem every time cell address of information aganist header is change. supose in first copy/paste Tel inforamtion is in A15, but second time it may be on A13, and 3rd time it may be on A17 and so on.
I want to make a macro which search header ("Location", "P.O.Box", "Address", "Tel", "Fax", "Category" ) from a Range A1:A30. than down two steps to copy header information (75325412) and paste in fixed cell location C1:C5 (C1=Name, C2=Location, C3: P.O.Box, C4=Address, C5=Tel, C6=Fax, C7=Category) in same sheet. and repeat the steps to copy information aganist header from all header in Range A1:A30.
I am trying to open a website, then for excel to download the csv file, then for it to save it in a specific folder under a specific name and file format (excel).
I am successful at opening the website with the following code, but how to do the rest.
Sub Searchez() Dim IE As Object Set IE = CreateObject("InternetExplorer.Application") IE.Navigate "http://quote.morningstar.ca/Quicktakes/stock/keyratios.aspx?t=clwrÂ®ion=USA&culture=en-CA&ops=clear" 'load web page google.com IE.Visible = True While IE.Busy DoEvents Wend
I have rather large Excel file that spans around 245 columns & has multiple users responsible for certain columns. Columns are chunked to provide data about a specific group. Every 72 hours, I need to provide to managers what’s currently on this file in a specific summary format.
I’ve recorded a macro that gets me half way there. Here’s where I’m clueless. After my macro deletes unnecessary columns, what remains are the columns for “Main Data” group + each of the 5 “Business” groups (Investors, Lawyers, Credit, Finance, and Support) which would have identical column headings.
(1) Name (2) Address (3) ID# (4) Control#
Furthermore, for each of the 5 “Business” groups, there are 9 slots (ie- a user can enter up to 9 unique entries for a particular group.)
Example- The Investor group contains 9 slots. Each slot will contain the 4 columns mentioned above. So there are 46 slots in total – 1 for Main Data, 45 (5 groups x 9 slots) for Business groups.
MY PROBLEM: I need a macro to now cut & paste all data from each of the 45 Business groups slots & then paste at the bottom of the MAIN DATA slot.
The final file would be 4 columns (as listed above) wide. Data from each of the 45 business group slots would be one below the other- all of it underneath the data in the Main Data group.
I attempted to record a macro where I’m copying a section’s data range starting from row2 to row4000 (I know there will never be 4000 entries. I did this just to ensure that all future data would be captured) then pasting that after the last entry in the Main Data.
Example- I’d copy data from Investor1 slot(starting at column E2-H2) & go about 4000 rows down. Then I’d press CTRL+Down Arrow key in column A & then click the down arrow one time to take me into 1st empty cell where I would paste my copied data. I was going to repeat this process for the remaining 44 slots.
I’ve added some extra entries to test the macro & the problem is that the recorded macro is pasting data in specific cell location in column A instead for looking for the 1st empty cell in column A & then pasting the copied data.
So far I've gone thought the net & tried to paste in a few VBA posts/tips that I thought would work. Here's what I have so far from tinkering around. I need someone to tell me what to replace the xxxxxxx line with. This would be the language to tell Excel to paste copied data range into the first blank cell in column A. I've gone thought the net & tried to paste in a few VBA posts/tips that I thought would work.
Here's what I have so far from tinkering around. I need someone to tell me what to replace the xxxxxxx line with. This would be the language to tell Excel to paste copied data range into the first blank cell in column A.
Sub transposedata() Sheets("ConsolidatedYTDReport").Select Range("E2:H4202").Select Selection.Copy XXXXXXXXXXXX ActiveSheet.Paste End Sub
I am trying write code withVBA to save separate file in a different folder with Loop.
Write a code with "loop" till it finds empty cell in the column and for every change in number a separate file needs to be saved in specified folder with file name as "10010, 10011,10012... and so on with data copied in the file saved.
I have an Excel file which has a macro that sucks in data from a number of separate files (two Excel, a varying number of csv). The macro grabs all the individual files and loads them into one of three worksheets with some formatting, sorting, and structuring on the way. All good so far.
I then need to take two of the worksheets and copy them to a new Workbook which I can send out to some users. So I use the Workbooks.Add method, and use the Selection.Copy on just the data (UsedRange.Rows/Columns.Count to ensure it is only the data) and Selection.PasteSpecial with the xlPasteColumnWidths, xlPasteValues, and xlPasteFormats options to copy the data over. None of the data is filtered. Just straight data.
I would expect the newly added workbook to be smaller than the one with the macros because the one with the macros has two extra sheets that I don't transfer, and the sheets I do transfer are identical.
And that's where it gets weird. The file with the macros and more data is 18.7Mb, but the new one with only two sheets is 24.8Mb. One is .xlsm and the other is .xlsx (because it has no macros).
I've tried opening the new workbook and saving as .xlsm (no material difference to the size) and as .xls (it got even bigger). I've opened the new workbook, gone to the end of the data and deleted all the blank rows and columns, but no effect (because the rows are already empty).
Why would the file with less in it be so much bigger (or bigger at all)?
I have an excel file that is 19,423KB. one worksheet has 4,600 rows of data and 24 corresponding columns. There are 3 other worksheets that have small tables on them. When I try to cut and paste or copy cells on the large worksheet it tells me that there are not enough resources to complete the task. I can USUALLY find a work around to these problems. Now it won't allow me to save the file. When I try it just comes back "Document not Saved". Is this file to large?
I recorded a macro to save a workbook to a specific folder using the current file name. However, I've tried to remove the absolute reference to a specific filename but it is not working for me. Am I close?
ActiveWorkbook.SaveAs Filename:= _ "H:Files and DocumentsPROJECTSSR 2 SS Phase Two Component ReliabilityWinTrac Files xt_conversionsexcel_version" & SheetName _ , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False