Macro To Copy Data From Specific Columns And Rows To New Worksheet?
Apr 29, 2014
What I am trying to do is to look at specific columns, then copy the data in that column from specific rows from sheet 1 (named TIA) to sheet Macro1. I think uploading a sample of the spreadsheet would be useful.
Unfortunately the spreadsheet is a living document and continues to grow in both column and rows.. The data extracted at this point is from row 7, 23-60 and copied into the new worksheet starting at A1.
Requirements:
1) Row 5 states the macro the column will be associated with. There can be more that one macro associated to a column.
2) When column is found, data from row 7 column (x) will be copied to sheet macro1 EX. If Cell G5 = macro1 then copy data from G7 to sheet macro1 at A1
3) When column is found, data from row 23 column (x) will be copied to sheet macro1
What I am trying to do is to write a macro that will automatically copy six columns from worksheet (Sheet 1) to another worksheet (Sheet 2). i.e. ‘Description of Project’, ‘WBS Code’, ‘Rate’, ‘Employee Name’, ‘Premium’, ‘Invoice’, ‘Status’, ‘Total Cumulative Hours’, ‘Total Cumulative Amount’ from Worksheet (from Sheet 1 to Sheet 2)
The problem arises as I know the names of the columns to be copied in Sheet 1 (as details above) but they can be in any order in sheet 1.
In additional the columns ‘Total Cumulative Hours’, ‘Total Cumulative Amount’ are total columns so when they are copied from ‘Sheet 1’ to ‘Sheet 2’ their values should be copied as opposed to the formulas
Worksheet 1 is a large data sheet containing columns of data (Date, State, Payment Method, etc, etc) Worksheet 2 is the 'Report' worksheet with 2 blank cells (A1 and A2) for users to manually enter the Start and End dates, a drop-list for State names (B1) and a drop-list for Payment Method (C1) - Cash or Credit Card.
How can I write a macro to:
1) Filter by Start and End Dates then, 2) Filter by State name then, 3) Filter by Cash or Credit Card then, 4) Copy these filtered records (i.e. whole row/s) onto the 'Report' worksheet starting at Column A, Row 5. 5) Macro to end with a 'Successful' message.
I have a macro that would check data in Column A and validate if a particular number is repeating, then for that number go to column B, Take the Values from there go to a new sheet and paste the values in a row.
I need to the macro to get the data not from the second cell.
Below is my macro
Sub test() Dim idRange As Range, c As Range Dim uniqueID As String Dim destSht As Worksheet, sourceSheet As Worksheet Dim r As Long Dim i As Integer Dim map As Object, key, item
I need to get a function that can copy some rolls in a worksheet 1 to worksheet 2 by sorting worksheet 1 according to column A of that sheet. I have attached a sample of what i intent doing for bether understanding.
I want to run macro for copying specific cell values from worksheets according to their headers in one final worksheet of the same workbook. worksheets can go upto 30-31 ws as per the dates in the month. This would really save time and energy of copy paste.
I have requirement to extact data into a spreadsheet. This data is extracted from CSV file which is huge normally over 7MB. I have found a macro on the internet which I have included with this post.
Sub split() Dim ResultStr As String Dim FileName As String Dim FileNum As Integer Dim Counter As Double 'Ask User for File's Name FileName = InputBox("Please enter the Text File's name, e.g. test.txt") 'Check for no entry If FileName = "" Then End 'Get Next Available File Handle Number FileNum = FreeFile() 'Open Text File For Input Open FileName For Input As #FileNum .................
I have also included reult data that I get after running the macro. I have cut down on data due to attachement restrictions. But usually there are multiple spreadsheets named "Sheet1, Sheet2, Sheet3 and so on". I have numerous requirements. First of all I want to be able to spreate data into columns. For now how I do that is by going to data -> text to columns and then selcting delmited and then selecting comma as my delimiter. Second thing I want to do is is only extract range of data from this output into a new worksheet. I am only interest in the name like for example ALBANY-Serial0/0/0 and data that is in the range of 8:00 AM to 6:00PM. So the new sheet should only have name and for that name data in the range of 8:00AM to 6:00PM for all the sheets "sheet1, sheet2 etc" until all data has been extracted.
I am working on a project that I feel should be relatively simple but I seem to be stuck. My Goal: To add information to specific rows of data in the worksheet. I want to use a user form, and eliminate as much typing for the user as possible. I have already designed my user form, and written the code to identify the row in which I want to edit. Nonetheless, I do not know how to code the insertion of the new data. The data I want to add will be in empty cells at the end(right) of the data table.
I have attached a portion of my data set.InsertQuote.jpg
Here is where I am. The words in red are just colloquial words that I cannot seem to put into code.
Private Sub CmdInsert_Click() Dim Company As String Dim PartNumber As Variant Dim Condition As String
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?
Custid loc city 123 us newyork 124 uk wales 876 in mumbai Sheet 2 custid newcustomerid 123 756 124 394
Outputsheet: Custid loc city 756 us newyork 394 uk wales 876 in mumbai
So it will check sheet1 custid with sheet2 custid. If both matches it will replace custid with newcustid.if cust id not exists it will load sheet1 recprds as usual.
I am trying to modify the macro listed below for the following example. It would work when I have only numerals in the cell but this new query, the cell has both letters and numbers.
I want to compare column "M" from worksheet one to column "B" in worksheet two. If the information matches, then copy the value adjacent from worksheet two column "A" to worksheet one column "L".
Here is the macro that worked for me using a search of only numerals.
figuring out why the data doesn't copy?
Macro:
Sub merge_accession_PS_rad_productivity() Dim rng2 As Range, c2 As Range, cfind As Range Dim x, y With Worksheets("Imaging_Summary") 'N4=Accession on Imaging Summary worksheet
I am looking for a macro which will take specific data from one sheet to the 2nd. I have attached the sheet. The Input data in the 1st sheet and the consolidated dat ain the 2nd one. Kindly assist. In the Final Sheet:
The Description column shld contain the data from B7:C7 and the B10:C10 together in one cell and that shld be copied till the end
The Description (Design steps) and Expected Result coulmn shld take data from the Test Step Description and Expected Result. And the Step Name shld be counted automatically till the last input. Test Name column shld be the 1st woksheet name.
I've been using this macro to pull data from multiple files, but instead of it creating a new tab, how can I have the macro pull the data and save it on a specific tab name(ex. Comp Stores). Here's the code I have currently.
Private Declare Function SetCurrentDirectoryA Lib _ "kernel32" (ByVal lpPathName As String) As Long Sub ChDirNet(szPath As String) SetCurrentDirectoryA szPath End Sub Sub Combine_Workbooks_Select_Files() Dim MyPath As String
I have set up a macro to clear data in COl A from row 2 onwards. I need to amend the code to clear the data in the following columns from row 2 as well
Col C to I and Col L to O
Sub ClearData() Dim LR As Long, i As Long LR = Range("A" & Rows.Count).End(xlUp).Row For i = 2 To LR With Range("A" & i) .ClearContents
In sheet Model RC BOM I am trying to copy all the rows under Level 1 (row 3), including level 1, until it reaches the next Level 1 (row 537) (not including row 537), and paste those cells in next tab (BIW) starting at row 2. The next operation is to copy all rows under Level 1 (row 537), including level 1, until it reaches the next Level (row 827), not including row 537, and paste those cells in the next tab (Chassis) starting at row 2.
The challenge is that I cannot use the row numbering in sheet Model RC BOM as a reference for coding because the content will change every week.
if there's a macro that can be run to check one worksheet. In this worksheet there is a column where the value should be "true". If this value is true, I'd like to copy the entire row of data into another worksheet.
There can be multiple rows of data where this condition is met.
I'm trying to get a macro together that will take a set of workbooks that I've merged (using Ron de Bruin's RDBMerge add-in) and transpose all columns from B to HB into rows. Now, I know that each spreadsheet is 210 columns and 244 rows large and they are concatenated on one another. Attached is a brief example of what I am trying to go from and what I am trying to get to.
I worked on a workbook which has multiple worksheets( mine has 6). The data doesn't start from A1. I want to copy the data from each worksheet into a sheet called summary. I want to create the macro that would only copy the heading row once.
I have two workbook having 8 worksheet each. Every day I need to copy data from previous day worksheet and paste it on new workbook with same sheet name.
For example :- Workbook1 is having sheet named aa, gg, tk ..... Workbook2 is having sheet named as same as Workbook 1
Now, I want macro to copy data from Workbook1, sheetname 'aa' and paste the same in workbook2 in sheet name 'aa' and likewise
how I might 'trigger' a macro to run when a certain cell was filled with any value at all. I have the macro working fine (it's a simple copy and paste special) but I want it to run automatically when the cell A20 has a value in it.
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)…
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.
What im trying to do is have a macro that will open a file called Blue 1.xls in location "I:SchedulesBlue" and then copy data from cells N13:034. Then paste it into another excel file (Press.xls)on worksheet "Press Break" cell G14.
The data that is copied not always fills up the cells N13:O34 so I need it to go to the next blank cell in column N and paste the information from file Blue 2, and so on for Yellow 1, Yellow 2, YellNR, and Green.
So to summarise I need a macro to open 6 files copy data from the same location on each of the files(N13:O34) then close and paste it into a master document(Press.xls) worksheet "Press Break".
I have been working on a macro that compares a existing list of data to an updated list of data and then either moves any data not on the new list over to a completed tab (followed by deleting the record on the existing sheet), and then adds any items not on the existing sheet, but which appear on the new list, to the existing list.
I have come across a stumbling block, i have managed to identify on the existing list the rows of data that have been removed from the new list and therefore need to be moved over to the completed tab, but when i select the data it selects the header row aswell (which will always remain the same row). Obviously this then pastes the header row aswell, and also i can't seem to get it to paste in the new sheet to the next available row (i.e this will be used daily and i don't won't to overwrite the infor already in the completed tab). the next issue i have is then when i go back to existing sheet to delete the data i just copied across, as the header was initially select this also gets deleted.
The code below, is the complete code, including filtering, copying some forumals etc. The area i am getting stuck on is highlighted in red:
Sub Update() Dim bottomrow As Long Dim My_Range As Range bottomrow = Cells(Rows.Count, "C").End(xlUp).Row Set My_Range = Range("A1:Y" & bottomrow)
I have one worksheet called WEEKS.xls which lists weeks 1 to 8, week1 being columns A,B,C, week2 being D,E,F, and so on up to week 8
I have another work sheet called supplier.xls which is a worksheet imported from a database. In this worksheet I have columns A to Q. I am only interested in the data in columns C, P & Q.
I have buttons along the top in the WEEKS.xls sheet, one for eack week. On week one when the button is clicked I would like a macro that would look in folder “Supplier Stock” for the worksheet suppliers.xls and then take the data from columns C,P,Q and paste them into the WEEKS.xls in columns A,B,C. On week 2 the data will be pasted into D,E,F and so on. On the supplier.xls there is a few gaps down the sheet , like row 15 & 16 and alo 19 & 20 if possible I don’t want the gaps in the WEEKS.xls. Also on column P it is a date format I would like that pasted into the WEEKS.XLS in a dd/mm/yy format
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 need a macro to copy data from "sheet1" "sheet2" "sheet3" / column E and F to the worksheet "final". The number of rows in "sheet1", "sheet2", "sheet3" etc. is variable.