Copying Rows IF Value
Apr 30, 2009
I have a macro which I have been successfully using for a while and it's served me well. But now I have far too much data on my source file (55-60k rows) and I only need data the data if Column C is "AB". I'm the first to admit that I know nothing about macros.
If anyone can tell me how to make this only copy the rows where Coulumn C is "AB".
Do While fn ""
If fn ThisWorkbook.Name Then
With Workbooks.Open(myDir & fn)
With .Sheets("3-Queues by Agent").Range("A1:R60000")
ThisWorkbook.Sheets(5).Range("a" & Rows.Count).End(xlUp)(2) _
.Resize(.Rows.Count, .Columns.Count).Value = .Value
End With
.Close False
End With
End If
View 9 Replies
ADVERTISEMENT
May 25, 2013
I'm not great anyways with VBA Macro.Effectively, here is my issue. I have a spreadsheet which is really badly designed.In one column I have multiple numbers separated by a comma. I need this data separated into new individual rows, but at the same time, copying the data in the other columns in that row to the new row.
Example of what I have:
Test 1 54 email1
Test 2 32, 343, 63, 34 email2
Test 3 4934, 5342 email 3
What I need:
Test 1 54 email1
Test 2 32 email2
Test 2 343 email2
Test 2 63 email2
Test 2 34 email2
Test 3 4934 email3
Test 3 5342 email3
I have have the following code below which paste everything into a new column and into a new row, but the problem I have is that it does not push the other rows data down, nor does it copy the 1st rows data (for that data set) into the new rows created.
Code:
Option Explicit
Sub Macro1()
Dim fromCol As String
Dim toCol As String
Dim fromRow As String
Dim toRow As String
Dim inVal As String
Dim outVal As String
[Code] ........
The amount of rows I have, so this manually (text to column, then transcoding etc) it out of the questions (i have 1000 rows of this!)
View 7 Replies
View Related
May 12, 2014
I have 2 columns of data E and F. Column E has 11 different words that randomly repeat, Column F has 10 years of dates, about 1,000 entries (10/11/12 format). Both columns values come from formulas.
I am trying to copy cells E & F to columns K & L starting in row 2 only if there is is data in column E (one of the 11 words) and skipping all others rows. Both the E & F values of tthe row must be copied together, i.e if text is in E45, then copy E45 and F45 into column K and L starting with K2 & L2. This is a task which will be repeated multiple times as data is replaced in columns A-D.
View 4 Replies
View Related
Oct 23, 2007
I have to copy the formatting from "rows G&H" for 40,000+ lines. Is there an easier way than doing the formatting then highlighting the first two cells (G4 and H4) then dragging the bottom right hand corner down 40,000 lines?
View 5 Replies
View Related
Apr 25, 2009
I have a spreadsheet (see attached) that has city names, accessories sku number and quantity sold for each week. I run this report every week and when the spreadsheet has empty rows which I delete, but there are some rows that also have partial data that can be deleted. Anyway, I would like to copy name of first store (los Angeles) in this sample and copy down till the next city comes up (San Diego) and do the same all the way down. I have total of 20 stores and I wondering if you guys know of a formula or vba code that could help me with this.
View 9 Replies
View Related
Apr 16, 2013
For example, I have an excel worksheet which has a main "master" list that has all of the cars that are sold along with the name of the salesperson who sold it all the way to the right (Column 6)
What i am trying to accomplish:
I would like excel to automatically take all of the rows which have the same salesperson name in column six and sort them into separate sheets, but i would also like these rows to automatically update if information is changed in them or if they are deleted on either the salespersons sheet or the master sheet.
View 2 Replies
View Related
Aug 8, 2007
How do I go about copying rows starting at A1 and counting down until there is a blank row in VBA?
I.e.
Row 1 - value
Row 2 - value
Etc etc
Then Row 13 is blank
I just want to copy all the data above the blank row, which I will then paste on another xls?
View 9 Replies
View Related
Aug 28, 2008
I have a workbook into which a number of rows will be imported (a variable number). These will be edited then I want all the rows to be stored in a ever growing database. At the moment I simply copy these rows open a second workbook and paste the rows into the first blank row in the second sheet.
Is there a way to do this automatically.
1) select and copy all rows containing data
2) open second workbook & find first blank row
3) Paste data into second workbook
4) Save and close second workbook
I think with some effort I could manage the copying and pasting but I have no idea how to open and close the second sheet automatically.
View 9 Replies
View Related
Feb 23, 2007
i am trying to copy rows from several worksheets into one master worksheet. if column F of any row has a value greater than zero then the rows should be copied to the master worksheet with all data.
View 5 Replies
View Related
Jan 16, 2007
I am trying to copy rows that contain a specific word from one worksheet to another.
View 9 Replies
View Related
Jun 22, 2009
I'm working on a project requiring the matching of data from multiple worksheets and got some useful advice from someone on here a few months ago to get it up and running.
At the moment I'm using SUMPRODUCT with an IF argument to check rows on one sheet for matches on 5 others and return a "Yes" or "No" value, which is working fine. The next bit of analysis however requires copying the value from another column on rows that match, and pasting it into the first sheet.
View 12 Replies
View Related
Feb 11, 2014
I was wondering if it is possible to copy a row without having the numbers ascend? I've attached an example spreadsheet and am trying to copy row 2, columns C - J to rows 3 - 16, but the numbers ascend when I do.
View 6 Replies
View Related
Jan 9, 2014
I have an excel sheet that I'm trying to format. Basically, the excel book contains sheets (with the months), and each sheet contains a list of clients, their package, their status, date assigned, and date updated.
I've made another sheet (Sheet2) that fetches everything and consolidating it to one sheet. Sheet 2 also cleans up the data to display only the items that are 'completed'.
The issue I'm having now is in splitting the list (assuming it has been cleaned up to show only the 'completed' items. I would need to split the list first by the date they were updated, and then if they were assigned the same date or not. In short:
--Get all items with date updated = Month1
----If date assigned = Month 1: List items under table 1
----If date assigned < Month 1: List items under table 2
I've used macro on the excel (and I'm not sure it's efficient enough. I'm not proficient with VB, so...). I'm not sure if it will work on Mac.
View 14 Replies
View Related
May 21, 2014
I have a sheet with a lot of different data. In column M in workbook "Maximo report" there are 5 different values. I want to copy the rows that contain CDC_HVAC and that have the value "INPRG" in column G to the sheet HVAC_INPRG. I want to do this for all 5 values. Once the rows are in their respective sheets I want to filter them based on a formula and then sort from oldest to newest. I dont want the file to be too big and I think that VBA is the way to do it. I am new to VBA
View 6 Replies
View Related
Jan 26, 2009
I have a spreadsheet with various details sorted by date and i am trying to create a macro that will run whenever the workbook is opened and search the column "Renewal Date" for a date between now and 3 months time. For all rows with a date that meet this criteria it will copy the relevant rows and paste them to a new worksheet with the header. The renewal date column could be added to so i need the macro to run until it meets an empty cell. I have attached an example workbook with cutdown data and my attempt at the macro.
View 4 Replies
View Related
Jul 1, 2009
What I'd like to do is to have the block of rows starting from "Agent:" and ending with "Total" copied into a separate worksheet and then have the worksheet named using the agent's name. I have highlighted the data in yellow in the attached reference file. I would like to have this done for all 58 agents. I could copy and paste manually but that wouldn't be the smartest way to go about this. I figure I probably need a looping structure for this but I am not yet proficient enough to figure this out quickly. I am supposed to have this done today.
Edit: The last part of this would be to have blocks of rows from the "sections" worksheet which use identical agent names also pasted below the data from the "questions" worksheet. I have attached the workbook I am working on now cutting and pasting manually.
View 4 Replies
View Related
Jul 15, 2009
I need to know the function to copy an unknown amount of rows. After a certain row it should copy everything.
So like after row A6 it copys every row below it with data in them then I want to paste it in another worksheet. I dont want to just do
Rows("6:65000").Select
Selection.Copy
If someone could point me to a good site that explains alot of useful VBA commands that would help me alot. Most of my problems come from just not knowing the full function names.
View 10 Replies
View Related
Jan 26, 2010
I am trying a little program to see if I could select full rows for copying. the code i use is as follows
View 5 Replies
View Related
Feb 11, 2010
I'm trying to copy multiple rows with a macro. Below code lets me duplicate one row at the time and the duplicate is inserted just below the chosen row.
View 2 Replies
View Related
Mar 4, 2013
I got this code to copy stuff from Raw data worksheet which has a Dynamics Atlas table to another worksheet named input. However, I noticed that some records are duplicated so I want the code modified to only copy unique records based on criteria in column B of the "Raw data" worksheet.
Sub Copy_atlas_table()
Application.ScreenUpdating = False
With Worksheets("Input")
.Range("A2:S2" & .Cells(Rows.Count, "G").End(xlUp).Row).ClearContents
[Code] .......
View 1 Replies
View Related
Sep 5, 2013
I have two workbooks say 'MASTER' & 'REVISED' in D:Office. The REVISED workbook contains certain rows colored in Yellow which contain the rectified data. How to copy those rows (rectified data rows of workbook REVISED) to the workbook MASTER in the same row number.
View 7 Replies
View Related
Jun 18, 2008
I have a spread sheet that I have locked with the expection of certain cells. I also have left the ability to insert and delete rows. The cells that are locked have functions in them run in sequance.
Is there a way that when the new row is inserted its copies the formula from the row above automatically but also adjust for the new row and adjusts the rows below it automatically?
For example if I insert a new row between rows 2 and 3 below.
(orginal layout)
a1 (unlocked) b1 (locked)(function is =sum(a1:b1)
a2 (unlocked) b2 (locked)(function is =sum(a2:b2)
a3 (unlocked) b3 (locked)(function is =sum(a3:b3)
a4 (unlocked) b4 (locked)(function is =sum(a4:b4)
(layout after inserting row)
a1 (unlocked) b1 (locked)(function is =sum(a1:b1)
a2 (unlocked) b2 (locked)(function is =sum(a2:b2)
a3 (unlocked) b3 (unlocked) *inserted row*
a4 (unlocked) b4 (locked)(function is =sum(a4:b4)
a5 (unlocked) b5 (locked)(function is =sum(a5:b5)
this is what i want the end product to be.
(layout if formulas are copied and adjusted after inserting row)
a1 (unlocked) b1 (locked)(function is =sum(a1:b1)
a2 (unlocked) b2 (locked)(function is =sum(a2:b2)
a3 (unlocked) b3 (locked)(function is =sum(a3:b3) *inserted row*
a4 (unlocked) b4 (locked)(function is =sum(a4:b4)
a5 (unlocked) b5 (locked)(function is =sum(a5:b5)
View 9 Replies
View Related
Mar 24, 2009
I am using Excel 2003. I have a worksheet called "RawData" which has a continuous list of invoices, I need to separate off the first invoice from the rest of the invoices into a new worksheet and call it "sheet1". The number of rows from cell A1 at the top left corner varies and is never constant from invoice to invoice however the last row of the invoice I need to move always includes the text string "NET PAYABLE TO".
So I need to copy all rows from "A1" to the row that has the text to a new worksheet called "sheet1", I then need to delete those rows only from the original "RawData" worksheet, leaving the remaining invoices in "RawData" intact. If it is helpful to you, the first row on every invoice has the text string "TAX INVOICE".
There are no empty rows between the "NET PAYABLE TO" row at the end of an invoice and the "TAX INVOICE" row at the start of the next invoice, so it is literally a continuous list.
Can this routine then be continued on all the other invoices in "RawData", copying them to new worksheets in the same workbook "sheet2","sheet3" etc until there is no data left in RawData, bearing in mind that there may be 10 invoices or 100 invoices in the "RawData" sheet.
View 9 Replies
View Related
Sep 1, 2009
I have one excel 2007 workbook with three sheets in it.
Sheet 1 is a master sheet with 1858 rows and 45 columns of data.
Sheet 2 has the qualifier data, that is, one column with 255 unique 6-digit integers each in its own cell.
Sheet 3 is a result or output sheet that is currently empty.
Here is what needs to be done.
Compare all of the 255 unique 6-digit integers from Sheet 2 with the integers in column number 15 (or Column O) of Sheet 1.
If there is a match then copy that entire row from Sheet 1 into Sheet 3.
View 9 Replies
View Related
Oct 20, 2009
I'm trying to create a macro that examines a sheet of data, and if the data in a certain column (column P) contains either A,B, or C then it would copy the entire row over to another sheet. If it contained a blank or D,E, F, etc,etc then it would just ignore that and move to the next row.
I have no idea where to start, i've searched google and here on Mr.Excel.
View 9 Replies
View Related
Jun 1, 2006
I have a main worksheet with several categories in column A. I would like to set up an IF statement VBA macro, where by if cell "A2" = XYZ, then copy entire row 2 to worksheet XYZ; if cell "A3" = ABC, then copy entire row 3 to worksheet ABC, etc.
View 4 Replies
View Related
Sep 22, 2006
The problem sheet attached to this thread. I would like to extract all rows belonging to one person to another sheet named after the person and also their status.
For instance, I want a VB script which extracts all rows with Mark when his status is A/V to another sheet named as Mark and likewise for Steve.
View 9 Replies
View Related
Oct 21, 2006
Macro written below gathers information from the source xls documents (which are located at "D:anetdata" ) and copy a new file ( located at "D:anet arih" ) according to different contents of two cells. Unfortunately macro copies solely Column A. But I want to copy entire rows between those cells. For example, if A400 contains "Days with most messages" and A500 contains "Subjects with most answers" , this macro copies cells between A401 and A499. But I want to copy entire rows between 401 and 499.
Sub EvrenYurdakuloglu()
Dim DosyaDuzeni As Variant
Dim GuncelSayfaAdi As String
Dim Hucre As Range
Dim ikinciAranan As String
Dim ilkAranan As String
Dim ilkDosya As Variant
Dim ilkSatir As Long
Dim islemAdedi As Long
Dim i As Long
Dim KlasorunYolu As Variant
Dim KlasorYolundakiDosyalar As Variant..................
View 4 Replies
View Related
Jan 16, 2007
I am trying to copy rows that contain a specific word from one worksheet to another.
View 9 Replies
View Related
Dec 17, 2012
I need to take a list of about 1,500 rows of data (single column) and convert it into columns of 9 entries. I know that I can select nine rows and then paste using transpose... But any way of "automating" the process?
So
1
2
3
4
5
6
7
8
9
ETC
ETC
becomes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 etc....
View 5 Replies
View Related