Macro To Copy Data To Other Sheet Based On Criteria...

Feb 19, 2009

We're working with a large workbook with data from A5:P20000 on sheet1.

I need to be able to pull data from sheet1 to sheet2 based on the invoice number in column A on sheet2.

Sheet2 will have different invoice numbers in column A, some of these invoices numbers are in column H on sheet1. I need excel to find these invoice numbers and copy the data from that row on sheet2 to the row with that invoice number on column2.

Example:
Sheet2 A5 has invoice number 1234457
This same invoice number is located on sheet1 H3400
Need to copy to sheet2 (starting in cell B5) the following cells from sheet1 (B3400, C3400, E3400, G3400, H3400, I3400, J3400, K3400, M3400, N3400).

View 15 Replies


ADVERTISEMENT

Copy Data From One Sheet To Another Based On Multiple Columns Of Criteria

Jul 27, 2013

I am working on a project to automate the import of data and fixing the formatting.

The data contains the date in column A and time in column B. The time is in increments of 15 min for each day. The rest of the data is in columns C:F. Some of the dates don't have all of the times within the day (so instead of 96 rows of data per day, there maybe 80 rows). I have a second sheet of just dates and times that has the correct amount of rows for each day. What I need to do is have the rows data that matches in both the date and time column from sheet 1 copied over to the corresponding date and time on sheet 2. Blank data rows on sheet 2 are fine. I have found some stuff on .Find, but the stuff I found was for specific searches.

Example

Sheet 1
7/27/13 12:00 AM 1 2 3 4
7/27/13 12:15 AM 5 6 7 8
7/27/13 01:00 AM 9 10 11 12

Sheet 2
7/27/13 12:00 AM 1 2 3 4
7/27/13 12:15 AM 5 6 7 8
7/27/13 12:30 AM
7/27/13 12:45 AM
7/27/13 01:00 AM 9 10 11 12

View 1 Replies View Related

Copy Data On New Lines From A Source Sheet Based On Criteria

Oct 2, 2006

I have a source sheet which contains data. Within this data there is a column (column 3) called Name and I would like to take the data from this sheet and paste it onto a new sheet but in grouped format. So take all instances where it finds criteria 1, then 2 and so on and just paste it on a new line each time it finds a criteria. So far I have the following code to search

Sub loopy()
Dim rngTemp As Range ' the range variable declaration
Dim intCounter As Integer 'counter as integer
' the following loop goes through all the cells in column a up until the last used cell in the column
For Each rngTemp In Range("a1", Range("a" & Rows.Count).End(xlUp))
'increment the counter if the cell has value fridge
If rngTemp = "Fridge" Then intCounter = intCounter + 1
Next rngTemp
MsgBox "There were " & intCounter & " cells equal to Fridge"
End Sub

View 2 Replies View Related

Macro: Copy Data Based On Criteria/Condition

Oct 16, 2006

Attach is a sample of my project. I have to loop through B9:B80 in sheet("Raw Data") and capture the value of each cell. EG:

* if Value captured is 120A --> check with sheet("SP14F") from the row which contains the same value.

* i have to check that the aperture, outer and inner values of Layer 120A and so on..of the Raw Data sheet is the same as that of in the SP14F sheet.

* if the values are not the same, change the font to red

i understand that this task requires looping and arrays.

View 4 Replies View Related

Copy Based On Column Criteria & Append To Another Sheet

Jan 18, 2008

I have a spreadsheet that is used to store statistical information on a monthly basis, some of this information may be incomplete and so will need to be acted upon month by month, What I need to do using VBA is: At the close of the spreadsheet check sheet1 and if there is any data (text) in cells N – Q on any line If there is move to sheet3 check for the next blank line then paste the data from only certain fields i.e. A,B, N-Q,R,S

Here is another problem

As the sheet will be used on and off during the month I don’t want data that is already been moved across to sheet3 to be copied again so there needs to be someway of checking if the info is already there? I have code now for the find last cell part of the problem.

Sub FindLastCell()
Dim LastCell As Range
With ActiveSheet
Set LastCell = .Cells(.Rows.Count, "A").End(xlUp)
If IsEmpty(LastCell) Then
'do nothing
Else
Set LastCell = LastCell.Offset(1, 0)
End If
End With
LastCell.Select
End Sub

View 9 Replies View Related

Copy Paste Multiple Criteria Based Rows To New Sheet

May 23, 2008

I need to copy specific rows that have a specific value in colum B and Colum M to new worksheets.

So from attached screenshot , say for an example macro shud filter rows that have "BigPond" in coloum B ,"RG2" in column M & "INT" in column W and i dont want all cells in these rows , i only want copy cells under column C,AK,AL,AM (in this order) to my other excel sheet that is named "BigPond" and it should paste it starting from Row5?

I want to avoid recording a macro as it selects a range and i am expecting more new rows every week so if a record a macro the cell range for selection changes and i get incorrect result.

View 14 Replies View Related

Copy Paste Rows To Another Sheet Based On Column Criteria

Jan 17, 2007

I have a file that has two sheets, I have some formulas in the first sheet named "Data",What i would like to have is, If column G in the sheet Data is "Closed", then i want that particular row to be cut from the sheet " Data" and pated in to the Sheet "Done".

View 5 Replies View Related

Copy Rows Based On Criteria, Paste As Values To New Sheet & Sort

Apr 15, 2008

I have spent a few days searching through forums but cannot find examples that i have been able to successfully adapt ( because they are to complicated for my limited knowledge). I have a workbook with 5 sheets, sheet1 (current), and sheet 4 (archive) are the important ones. I need a macro to

A) copy rows from "current" to "archive" ( to the 1st empty row) if column S of "current" contains "Closed" ( the word is generated by formula).

B) The paste needs to paste special values and number formats ( want to lose formula but not conditional formatting).

C) data sort "archives" based on col A - this puts the newly archived data into correct sequence.Data sort lowest number 1st

D) delete the copied rows from "current".

e) give me a count of how many rows it deleted, (I have a macro to insert rows so will run that manually to recreate the correct number of emtpy rows (with formula and formatting) to bring the current sheet back to usual size.

I tried modifying a macro by RPaulson (based on cells on one sheet to cells on another), to work with entire rows but couldn't get it to work.

Found that paste special uses PasteSpecial xlPasteValues, but , and thats about it.

View 6 Replies View Related

Copy Data From One Sheet When Criteria Is Met

Apr 25, 2007

I have is the formula works as long as there are no blanks in column "A" my situation has changed and I will have blanks in column "A". I've attached the file to show how if you have blanks. I was trying to work through the blanks any help would be a bonus.

View 2 Replies View Related

Copy And Paste From One Sheet To Another Based On Column A Using A Macro Copy Button

Jan 22, 2007

I want to copy and paste from one sheet to another based on column a using a macro copy button.

E.g. if column a value = apple then copy that row into the apple sheet.

View 9 Replies View Related

Copy Data From One Sheet To Another (special Criteria)

Apr 18, 2014

I have a report extracted from a system but the output format makes it difficult for data manipulation. If order to do that, I need to arrange data to a specific format.

From the attached file:

CopytoAnotherSheet.xlsx

I like to copy data from Col A, B and C from Sheet 1 and represented in a nice order to Sheet2 I have started writing out the steps but finding it hard to continue.

View 14 Replies View Related

Copy Data According To Criteria To Another Sheet Within The Workbook

Oct 31, 2008

i need a macro that will copy data according to criteria to another sheet within the workbook,

Raw data is in Sheet "Workings" from range A1:L,???? (not fixed), i need the macro to filter Col b and look for string CBA, CITIAIMS, MIR ASIA, STATE STREET, CITIBANK, REG then copy all data relating to these string to Sheet- " Cash_To_External_Custodian"

Workings
Account CodeCustodianSourceValue DateBreak DateAgeSideCCYLedger AmountStatement AmountAmount DifferenceError TypeQLGACITIAIMSDES21-Oct-0821-Oct-08-6SCRAUD0.0063,115.1163,115.115647366QLGSBQLGACITIAIMSDES22-Oct-0822-Oct-08-7SCRAUD0.0011,665.0311,665.035649060QLGSBQLGACITIAIMSDERIV28-Oct-0828-Oct-08-13LCRAUD100,000.000.00-100,000.005661452QLGACITIAIMSDES28-Oct-0828-Oct-08-13LCRAUD18,274.880.00-18,274.885655105

When pasting data to "Cash_To_External_Custodian", i would like the macro to paste to the required columns as per my screen dump below, as you can see i want the macro to skip Col b ,Starting Range is A6

Cash_To_External_CustodianAccount Code Case RefCustodianSourceValue DateBreak DateAgeSideCCYLedger AmountStatement AmountAmount DifferenceError TypeQLGACITIAIMSDES21-Oct-0821-Oct-08-6SCRAUD0.0063,115.1163115.115647366QLGSBQLGACITIAIMSDES22-Oct-0822-Oct-08-7SCRAUD0.0011,665.0311665.035649060QLGSBQLGACITIAIMSDERIV28-Oct-0828-Oct-08-13LCRAUD100,000.000.00-1000005661452QLGACITIAIMSDES28-Oct-0828-Oct-08-13LCRAUD18,274.880.00-18274.885655105

View 9 Replies View Related

Macro To Select Multiple Files And Copy Them Based On Criteria?

Mar 10, 2013

This is what I am trying to achieve:

1) Prompt user to select a file (or multiple files)

2) Copy the files that meet certain criteria to a folder

My attempt (fail):
VB:

Sub FILES2SFTP() Dim FileNames As Variant Dim I As Integer Dim fso As Variant Dim Data As String ChDrive "G:" ChDir "G:TEST" Data = InputBox("Enter the date", "Enter the date", Format(Application.WorksheetFunction.WorkDay(Date, -1), "yyyymmdd")) Set fso = [code]....
I get error 424 object not found in this line:

If fso.getfilename(FileNames(I).Name) = ("Name1" & Data & ".xls" Or "Name2" & Data & ".xls") Then

View 3 Replies View Related

Pull Data From Sheet Based On Criteria - Populate UserForm And Ask For Missing Data

Feb 8, 2014

I have a spreadsheet that is updated weekly -- but every week new info is added that needs a user to input corresponding info. I use a vlookup function to link to another spreadsheet that populates the info from previous weeks and the info that is missing shows up as #N/A...

First I was using a msgbox function to get the info:

HTML Code: 

For Each b In myrange
If Application.IsNA(b.Value) Then
Employee = b.Offset(0, -2).Value
SSID = InputBox("Please enter ID# for " & Employee & " :", "New Employee Found")
b.Value = SSID
End If
Next b

But it can be up to 30 different new employees... and that is time consuming.

I would like to make it more user friendly by creating ONE userform that displays all of the employees as labels -- has a text box in which to put the ID # -- and then has a drop down box to choose the type of employee (2 options). I want all of that info to go back to the reference spreadsheet so it will be saved for following weeks, and then redo the vlookup to get the info into the new weekly spreadsheet (I can do that part)....

HTML Code: 

Private Sub CloseButton_Click()
Unload UserForm1
End Sub

Private Sub ComboBox1_Change()

[Code] ......

View 2 Replies View Related

Copy Row Data To Another Worksheet Based On Criteria

Sep 28, 2006

Data exists in a workbook's sheet name "0293" in columns A, B, C, & D. If a row's value in column B exceeds zero, the entire row & formatting needs to be added to the bottom of data in a sheet called "Comprehensive" of the same workbook and put 0293 in column E of the same row. What would be the simplest VBA code to copy sheet 0293's data & add it to the "Comprehensive" sheet with the sheet name in column E of the same row?

View 2 Replies View Related

Copy Data To New Workbook Based On Criteria

Apr 4, 2008

I have a workbook that is used to track job estimates.

What I would like to have is a macro that would search through column N on the original file and if any of the cells have "No RFE" in them - generate a new workbook with only this list that would include any data from columns C-U copied from the original file.

I've been seaching the forum, but so far have had little luck finding something that suits my needs.

View 9 Replies View Related

Return Data To Another Sheet Based On Criteria

Jul 28, 2006

Sheet 1
Column A = Dates
Row 1 = Filenames

I enter a Y in the intersecting cells of the Filenames & Dates to show which files were downloaded.

I need is a formula that will rearrange this layout onto Sheet 2 so that each ‘Y’ (downloaded) filename is inserted in a cell corresponding to the Date.

(see attached sample)

View 9 Replies View Related

Copy Data Across Multiple Worksheets (based On Three Criteria)

Feb 16, 2010

I have data on a worksheet (“Interface”) that I need to copy over 7 other tabs for analysis.

("Module_1", "Module_2", "Module_3", "Module_4", "Module_5", "Module_6", "Module_7").

The linking Field on the Interface tab defines what row I need to paste the data to on Module 1-7. The column headers are the same on both the interface and other tabs (“YES, NO, N/A, BLANKS, STANDARDS MET, STANDARDS NOT MET, NOT APPLICABLE”)

The tab is selected based on the row
Module 1Medication Management
Module 2Privacy
Module 3Process
Module 4Patient Safety
Module 5Medical Records
Module 6Infection Control
Module 7Environment of Care

I’m trying to modify code written for a similar purpose with no luck. This is the code I'm trying to modify. I know I'm not on the right track yet.

View 2 Replies View Related

Copy Data From Another Sheet If Adjacent Cell Meet Criteria

Aug 13, 2008

I have a have excel problem Im trying to figure out. I have 2 sheets. Sheet1 and Sheet2. I want to copy into sheet1 cell B2 the contents of sheet2 column C row x iff sheet2 column B row x = 1. There will be only one cell in that column equal to 1, so I will be copying that cells(colB; rowx) adjacent cell (colC;rowx) contents. This is what I have so far but it doesnt work. =IF('Sheet2'!B:B=1,DONTKNOW WHAT TO PUT,""))

View 5 Replies View Related

Automatically Copy/Paste Data From Input Range Based On Criteria

Sep 4, 2006

I have a workbook with 2 - worksheets "DATA" and "LETTER".

The "DATA" sheet has columns "First Name" "Last Name" "Address"...etc.

The user can enter in either a "X" or a "x" in cells B6:B100 on the "DATA" worksheet.

After the user enters a X or x and hits the macro button I need it to copy certain cells from "DATA" worksheet to "LETTER" worksheet. I have listed a example below.

In this example if a "X" or "x" is entered into B6 on "DATA" worksheet and the macro button is hit, then: ....

View 9 Replies View Related

Copy Data Table Seperate Sheets Based On Column Criteria

May 12, 2008

I need to copy all the work sheets into one single work sheet (mastersheet). The source work sheets are having same column structure. The condition which i need to take care of is that after column 3 if at all there is any data till column 10 then in the destination mastersheet these should be copied in different rows with first two columns repeated. I need to do this using VBA macro.

View 9 Replies View Related

Macro To Sum Data Based On Criteria

Aug 17, 2012

I have a data which i need to total based on document types.

Document types in cells are AB=CELL A1, ZR=CELLL A2, ZP=CELL A3,
SK= CELL A4.And amounts in rows 555=CELL A1, 625 = CELL A2,
725= CELL A3, 925=CELL A4 and so on.

My challenge is to get all the total of ZR,SK,AB type of documents using macro.Initially i used this formula, however now document types are more than one.

=SUMIF([Book1]Sheet1!$C$2:$D$4,"zr",[Book1]Sheet1!$D$2:$D$4)

View 6 Replies View Related

Macro To Copy Data From Sheet 1 To Multiple Pages On Sheet 2 In Correct Cells

Jan 15, 2009

I have attached a 97-2003 .xls file with data for multiple store locations on sheet 1, and the desired result on sheet 2. I am actually using excel 2007, but I dont think I need any special features that it provides.

I will try to explain the issue here without opening the attachment.

Here is an example of the Data on Sheet1

View 13 Replies View Related

Macro To Fetch Data Based On 2 Criteria?

Oct 22, 2013

Attached is my .xls with dummy data Fetch data By Director.xlsx.

My intention is that once the Director and Month in tab 'By Director & Month' is chosen and the Fetch Data commandbutton is clicked, a new workbook should open.

This new work book should have :

all entries in tab 'Monthly Invoice Input' for that Director-Month combination,along with a sum total of column Q(Total invoice amount) in the last row.

View 6 Replies View Related

Macro To Copy 2 Columns To New Sheet Based On Value In A Different Column

Jul 4, 2014

I'm trying to create a macro that will look at the values in one column (column G) and whenever there is a new value, it will copy the data from 2 other columns (I and J) into a new sheet with the original column as the title. I can't think of a better way of explaining that so I've attached a sheet with 'Raw data' being the source sheet and 'Outcome' being the hoped for final product.

I have color coded the sheet to show where the data is coming from, but do not want the colors in the actual sheet.

View 8 Replies View Related

Excel 2007 :: Summing Column On Data Sheet Based On Multiple Criteria

Feb 23, 2012

Excel 2007. I have an Excel file that contains a data dump from an external database file with numerous analytical sheets that perform calculations. Some of these calculations utilize the SUMIFs function that was introduced in Excel 2007. This function does an outstanding job of summing a column on the data sheet based on multiple criteria.

However, someone high up in management in my organization would like to "drill down" into the data behind the

SUMIFs formulas to get a quick snapshot of the lines in the database that roll into the
SUMIFs formula. =SUMIFS(DataBase!E:E,Data!A:A,C7,DataBase!B:B,D7,DataBase!C:C,E7,DataBase!D:D,F7)

If I double click on a cell with the formula above, Excel takes me to the Database tab and selects Column E which is close, but not exactly what I need. What I really need is for Excel to only show the rows on the database sheet that make up the total in the SUMIFs formula and not the entire data dump from the database.

At present, we have to manually apply the autofilter on multiple columns to show the rows in column E that make up the total in the SUMIFs formula which is a tedious and time consuming task. Is there a way to force Excel to do this? Suggested custom database application or pivot tables, but we do not want to reinvent the wheel.

View 2 Replies View Related

Macro To Pull Data From Multiple Sheet To Main Sheet Based On Column Headings

Sep 13, 2012

I need a Macro which pulls the data from different sheets of excel (which is not formatted properly) to Main Sheet. Also some of the columns will not have the same names, so macro should handle this exception as well.

View 8 Replies View Related

Macro To Copy Data From One Sheet - Paste In Another Sheet

Jul 29, 2014

How to create macros. I need to copy a certain group of cells from one sheet to another, and then do it for x number of times. I'm just using the record function and now i'm lost. Here is the code i currently have:

Sheets("Mapping QTR2").Select
Range("B137:D230").Select
Selection.Copy
Sheets("ExpDB_Q1").Select

[Code] ....

Also, column C is blank. i would like to get the values from another list in the same workbook, say "branch list". I would like to populate Column C with one specific branch for each "batch", if that makes any sense...

View 3 Replies View Related

Copy Column Data From Multiple Worksheets To Single Worksheet Based On Header Criteria

Oct 18, 2013

I have a workbook with many sheets of similar but not identical data. I need to extract columns from each sheet based on 5 header criteria and paste them to a single sheet. Each worksheet contains these 5 criteria.

I've been working with the VBA script I've pasted below. It's grabbing the 5 column criteria that I have in sheet 12, and comparing them to sheet 1 in the workbook, then copying them to sheet 12. This much is good, but I need the script to also return the data from the other worksheets as well. I've tried modifying the script based on other loop functions in other scripts I've found, but I'm not having any luck.

View 14 Replies View Related

Macro: Count Data In Range Based On Criteria

Nov 10, 2006

I have a list of several ranges defined in vba, and i am trying to find which range a cell containing word is in excel. Im am looking for help for a good way of doing this.
For an example: Say I have 2 ranges defined, the first range corresponds to column A, the second to column B (just an example). The word "Dog" is written in cell B15. I want to find out in vba what range "Dog" is in. I would like some vba code to check and find either if it in a given range (boolean) or a way of checking a list of ranges and returning which it is in. The word will only appear once on the spreadsheet. I have played around with the find command (A=range.find(Pl), then check if A exists) but i havent had any luck (I get an 'Object variable or With block variable not set) I tried searching for a while, but was having trouble finding something related to what i am trying to do.

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved