Copying Rows Based On Values

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


ADVERTISEMENT

Copying Values From Matched Rows

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

Copying Values But Keeping Rows That Have Formulas In Them

Dec 31, 2012

I have a spreadsheet with a lot of financial information going down a column (about 500 rows down). Most of the cells are just typed in, but certain rows have sum formulas in them. Is it possible to copy values from another workbook, paste the values in, but somehow keep the formulas that are running through?

View 1 Replies View Related

Copying Rows With Multiple Colum Values To New Sheet

May 21, 2008

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

So from below 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 9 Replies View Related

Copying Rows Based On Range Selection

Aug 27, 2006

I would like to copy selected rows in a range D19:I49 to another sheet, by clicking a button to bring up a User Form containing a List Box, seven Option Buttons (one for each sheet), an OK and Cancel Button. When the User Form is displayed, the required rows are selected in the List Box, then the required sheet is selected via an Option Button. Upon clicking the OK button it pastes (only the values) to the selected sheet, but to the next empty row (if there is already data entered previously) in the same range as above (D19:I49). All seven sheets are identical and are named Monday, Tuesday, etc. to Sunday. If the option button selected is the same as the active sheet a message box could be displayed to ask the user to select another option button and upon clicking the OK button on the message box return the user to the User Form once again so that the correct option button may be selected.

View 2 Replies View Related

Copying A Row Based On Matching Unique Values

Jan 26, 2009

I have the following code which takes a unique value from 'sheet 1', and searches for the value in 'sheet 2'. If there is a matching value in sheet 2 it will copy the full row into sheet three.

I need to extend the code so that all values from 'sheet 1' are copied to 'sheet 3' even if there is no matching value in 'sheet 2'. If there is a matching value in 'sheet 2' however I need the entire row to be copied to 'sheet 3'

Sub moving()
Dim c As Range, d As Range
Worksheets("Sheet2").Activate
For Each d In Worksheets("Sheet1").Range("A1:A500")
For Each c In Range("A1:A15")
If d = c Then
c.Resize(1, 70).Copy
Worksheets("Sheet3").Range("A65536").End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues
Exit For
End If
Next
Next
Application.CutCopyMode = False
Worksheets("Sheet3").Activate
Range("A1").Select
End Sub

View 2 Replies View Related

Run Time Error When Copying Rows Based On Word

Jan 10, 2009

Here is my table which is just a test sample of the larger table, but in the end, it is column 1 I want to base the new ws on.

Before Macro
AY *AB1UnitCount2533210431 LGR SQ10584631 LGR SQ7726 Excel tables to the web >> Excel Jeanie HTML 4

The code below works fine through the first instance of the match and adds a new ws based on the name, but when it gets to the second match the macro tries to add the ws all over again and I get a run time error 1004 which states you can not add a ws and name it the same as one that already exist. I only have one sheet in my wb titled "AY". How can I also have the two column headers transfer to the new ws?

Public Sub CopyUnit()

Dim N As String
Dim i As Long
Dim ws As Worksheet
Set ws = Sheets("AY")

N = Worksheets("PAS Codes").Range("L14").Value

For i = Range("A65334").End(xlUp).Row To 1 Step -1

With ws
If Cells(i, 1).Value = N Then
.Rows(i).Copy
Sheets.Add.Name = N
Rows("1:1").Select
ActiveSheet.Paste
End If

End With

Next i

Application.CutCopyMode = False

End Sub
After Macro
31 LGR SQ *AB1UnitCount231 LGR SQ7331 LGR SQ10 Excel tables to the web >> Excel Jeanie HTML 4

View 9 Replies View Related

Inserting Rows And Copying Data Based On A Value In A Cell

Aug 14, 2009

On sheet "Create Package" in cell "AA14" I have a value (lets say 2).

I want it to go to sheet "Samples" and insert a number of rows equal to the value on sheet "Create Package" cell "AA14" (so 2 rows)

I have a header row in row 1, so I would like it to insert the designated number of rows beneath that.

Then I would like it to copy a designated number of rows (based off of the "AA14" value, so 2) from the "Create Package" sheet starting at row 66 and then paste special values into the new rows that were inserted on sheet "samples".

View 9 Replies View Related

Copying Rows From Multiple Books To One Book Based On Condition?

Jul 27, 2012

I have eight sheets that have lists of questions in, which I want to copy across to a results sheet if the answer to a question is 'Yes'. Each question takes up rows B:H inclusive, and I would want to copy them to rows B:H in the results sheet. The "Yes" value will be found in column F of each row.

How can I set up a macro to copy the entire rows (without formatting) into a results sheet properly? I've tried every solution I can find but always hit a roadblock somewhere.

Ideally I would like to have a 'populate' button on the results sheet that would find every question that was answered 'yes' across the eight survey sheets and import them into results sheet.

View 2 Replies View Related

Macro For Copying And Duplicating Data Based On A Cell Values.

Aug 22, 2009

I am trying to copy two cells from one worksheet to another in the same work book based on the value in Column B of one of the sheets. This is just a building block to a larger script I am going to create.

Below is my attempt but I keep getting an error at Range(Cells(x, 3)).Select.

View 7 Replies View Related

Hide Blank Rows Based On Values In Other Rows

Nov 3, 2006

I have a worksheet used for inventory. In Column A is the quantity (to be entered manually). In Column B is the product description. In Column C is the price of the product, and Column D the total price (column C price x the quantity entered in Column A). At the bottom of the worksheet is a grand total. Also, Column B (products) is grouped into subheadings by the supplier each product came from (for example, row 6 has the title PPG, and then rows 7-137 list every product from PPG).

The calculations in this worksheet work fine. What I am trying to do is, using a macro once all of the appropriate quantities are entered in column A, automatically hide every row of product that does not have a quantity. The tricky part is, if no products under a given supplier subheader are entered, the subheader also hides, and if a quantity is entered, that subheader shows. For example, if I have no quantities under any products for PPG, then the PPG subheader hides, but if just one quantity is added, PPG shows. Also, this list will be constantly updated, new products will be put in and taken out all of the time, so I cannot base the macro on a specific number of rows.

View 2 Replies View Related

Delete Rows Based On Values In Rows Below

Jun 20, 2008

I am copying a price list from a worksheet. I currently have a script that deletes unwanted rows (products) but these products' header rows' are left. I also want to delete these text based headers. One solution might be a script that reads a columns cell value in the row(s) below and if values are missing the header row should be deleted.

View 2 Replies View Related

Add Rows Based On Values

Sep 9, 2009

If a numeric value exists in 'Column F' then do the following

1. Create 25 rows of same SKU in 'Column B' and add the leading consecutive number i.e. -1, -2, -3 etc. etc.
2. Reference each new row with it's corresponding key on 'Column F'. see reference chart for the corresponding number.
3. All other columns may be blank.
4. If N/A exists on 'Column F'. Do nothing. SKIP
5. Delete ALL ROWS that include numeric values with commas in "Column F'

Attached is original version which shows 2 rows. One with number values in 'Column F' and one with an N/A. Also there is a version that shows what happens after the macro would run. A workbook is attached with the reference table.

View 3 Replies View Related

Delete Rows Based On Values

Nov 10, 2008

I have a 20,000 row text file that I import. It has blank rows, page headers and footers, and many rows at the bottom that I do not want. I have been cleaning up the data manually but this takes a great deal of time and I have a need to perform this clean up on a more frequent basis.

I have tried recording a macro to do some of the deleting but I am running into an issue that I do not know how to over come. When I filtered the data based on "Blanks" on a specific column and then try to delete them in mass, Excel errors out stating that my request was too complex.

View 11 Replies View Related

Hiding Rows Based On Multiple Values

Aug 7, 2012

I've tried several approaches on how to code this, but can't figure out how to work it. I have a large spreadsheet; which dynamically changes in both column and row counts. So, I have an array of values. If any cell has a negative value, that cell text needs to be changed to red AND that row needs to remain displayed. If ALL values in that row are >=0 then the row can be hidden.

The array is actually a pivot table named QTD

For Example: If cell D5 = 5 and F5 = -3 then Row 5 should remain displayed.

If Cell D6 = 5 and F6=0 then row 6 should be hidden because all values are > 0

Then I was thinking of using the case statement to hide the rows but can't figure the syntax. I'm open to any other means of performing the taks as long as the initial array dynamically to encompass all the data.

View 7 Replies View Related

VBA Hide Rows Based On 4 Different Values With Combobox

Nov 16, 2011

I have a vba to hide certain rows based on 4 values (either 15, 20, 25, 30) are the choices in the 'ComboBox' drop down list. I also have the rows grouped so i need to make sure to collapse those back each time. Here is the vba i'm using, but its not quite right for some reason.

PHP Code:

Private Sub ComboBox1_Change()        
If Range("J8").Value = "15" Then            
Range("A185:A244").EntireRow.Hidden = True            
Range("A245:A304").EntireRow.Hidden = True            
Range("A305:A364").EntireRow.Hidden = True            
Range("A365").EntireRow.Hidden = False            

[Code]...

View 1 Replies View Related

Compare Rows Based On Same Values In First Column?

Jan 5, 2012

I have a spreadsheet which will have several rows of data.

What I need is for some code to locate the duplicate values in the left most active column and then look over the rows that they are populating and delete and cells that are not present in each of the rows pertaining to the duplicate value in 1st Column and if possible remove all the blanks.

I have a sample, I will attach it and explain alittle better there.

View 9 Replies View Related

Hide Rows Based On Two Cell Values

Feb 1, 2009

Is there any way to hide a row if columns 6 and 7 both show either a "-" or a number lower than 0.5? Cells in both rows contain a VLOOKUP formula.

View 9 Replies View Related

Deleting Rows Based On Values In Certain Column

Oct 24, 2006

How can I delete rows in a worksheet using values in a certain column as criteria?
Example: I want to delete all rows that show a value of zero in column k. How is this done?

View 6 Replies View Related

Hide Rows Based On Other Cell Values

Sep 8, 2007

I need to hide rows on a worksheet based on entries from DATA VALIDATION dropdown lists on another. Due to the fact that all the entries are on a different page, and there is no active cells or entries made on the "second" worksheet, the WORKSHEET_CHANGE events will NOT work. Trust me, I have spent two days searching the net for a possible answer and trying every trick I could find. Not to seem redundant or a pain, but right from the git-go, FORGET the WORKSHEET_CHANGE event as an option. I need a way to fire the macros from a formula change in a linked cell, and it won't be an active cell, nor will there be any kind of entry made on that page at all. ALl the entries (choices) will be made on another sheet, but the result needs to be hiding the rows not required based on the choices I make. There are over 300 lines and when I am done there will be only approximately 35-40 left. Right now the people using this are actually making copies of the workbook, and then deleting the worksheets they don't need (I am hiding those with an array) and then deleting the lines they don't need on the worksheet remaining. (Stupid and slow I know, but I didn't develop this workbook, I'm just trying to bring it out of the stone age) Here is some sample code with what I want to do, except it is of a WORKSHEET_CHANGE nature and will not work.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("INPUT!M6"), Target) Is Nothing Then
Rows("11:50").Hidden = True
If LCase(Range("INPUT!M6").Value) = "100" Then Rows("31:50").Hidden = True
If LCase(Range("INPUT!M6").Value) = "100" Then Rows("11:30").Hidden = False
If LCase(Range("INPUT!M6").Value) = "225" Then Rows("11:30").Hidden = True
If LCase(Range("INPUT!M6").Value) = "225" Then Rows("31:50").Hidden = False
If LCase(Range("INPUT!M6").Value) = "0" Then Rows("11:50").Hidden = False
End If
End Sub

View 9 Replies View Related

Duplicate Rows Based On SUM Of Cell Values

Mar 1, 2008

I have a number of rows that I want to have duplicated X number of times (and altered) where X is found by looking at certain cells within each row.

There are four numbers in each row, and I want to split them up into multiple rows each with three zeros and one one.

I would like to convert data from this:

Name W X Y Z
John 1 0 0 0
Doug 0 0 1 0
Karl 3 0 1 0
Mike 0 1 1 2
etc.

...to this:

Name W X Y Z
John 1 0 0 0
Doug 0 0 1 0
Karl 1 0 0 0
Karl 1 0 0 0
Karl 1 0 0 0
Karl 0 0 1 0
Mike 0 1 0 0
Mike 0 0 1 0
Mike 0 0 0 1
Mike 0 0 0 1
etc.

You can see that the W, X, Y, and Z columns from the four new Mike rows sum to equal the values in the original Mike row (0, 1, 1, 2), but everything has been split so that each row just has a single one in it and three zeros.

Does anyone have an idea of how to do this? Thanks Auto Merged Post Until 24 Hrs Passes;I thought of another way of putting it that may be easier to understand.

Given an input row of "George, 4, 7, 3, 2", I would like the output to contain 4 rows of "George, 1, 0, 0, 0", 7 rows of "George, 0, 1, 0, 0", 3 rows of "George, 0, 0, 1, 0", and 2 rows of "George, 0, 0, 0, 1".

View 3 Replies View Related

Deleting Duplicate Rows Based On Cell Values

Nov 28, 2013

I have a sheet with 45,000 rows. Let's say each row has 4 columns: Create_timestamp, Update_timestamp, email_address, and o_flag

Many rows have duplicate email addresses. I would like to remove all the duplicate rows, EXCEPT for the row with the most recent Update_timestamp.

And actually, if I could just "hide" all those rows, that would be even better, but I'd be happy just figuring out how to delete all the "old" rows, so I just have a list of unique email addresses, with their create/update timestamps and o_flag column. Seems like this is such a basic use case for "Remove Duplicates,",.

View 1 Replies View Related

Combining Some Of Rows Values Based On Multiple Criteria (2)

Apr 18, 2014

I have a table based on transport numbers who sometimes have doubles. Example:

Number Postcode Value1 Value 2...
106200 8500 10
106200 8500 5
106200 8600 6
106201 5500 4
106202 4000 1
106202 4000 1

So it works as following:

A transportnumber can have multiple instances of itself, such as 106200. This transport number can also have multiple instances where the postcode is the same. These are the rows i want to combine

So shortly:
Transportnumber double/triple...+ Postcode double/triple...= combine these rows.

if only transport number is double, or only postcode, then dont combine. I want it to combine 2 columns of values, one will b the kgs, other one a price.

So example of end result for 106200 would be
106200 8500 value+value (these 2 rows matched so it combined the 2 values i want it to)
106200 8600 value ( this was unique so it stays unique)

View 4 Replies View Related

How To Update Rows Based On New Values So That Those Are Pulled Automatically

May 27, 2014

I create a report that shows one set of numbers against another set of numbers based on a transactions list I pull monthly. The Report tab is really simple and is based on the sumifs. Sometime, new accounts are created that I don't know about. They show up in the transactions table but not on the Report tab. Is there a way to automatically add new accounts/rows on my summary sheet so that no account is missed? Is there also a way where columns A and B on the Report tab are unique values that are pulled from the transactions tab? Hence, if a new number and description are added, the list just picks it up. In my case however, there are tens or hundred of lines with the same accounts/descriptions.

View 3 Replies View Related

Hide Range Of Rows Based On Cell Values

Aug 13, 2014

I've been trying to put together some code to hide a range of rows on one page based on cell values on a different page. So basically Sheet1 cell A1 value is 10, A2 value is 20. When macro is run via button rows on Sheet2 from 10-20 would be hidden. The issue is the values in the cells on Sheet1 will vary. I thought something like the following would work but it doesn't.

[Code] ....

View 6 Replies View Related

Insert Rows Based On Text Values In Cells?

Feb 20, 2014

I regularly run a report that comes out in a slightly different format each time depending on whether or not there is data for specific criteria. for instance (sample attached): criteria a, b, and c are in rows, 1, 2, and 3 in columns. a, b, and c are expected to repeat themselves several times. if there is no data in one instance of b then you may see something like abcacabc.

I'd like to loop through each row in column a, check to make sure that it is the correct value (either a, b, or c) and if not, insert a blank row so I can then copy the data to my final project without having to worry about formatting.

the example above would then become abca cabc

View 3 Replies View Related

How To Hide Specific Rows Based On Values In A Different Worksheet

Mar 7, 2014

Say I have two worksheets, "Sheet1" and "Sheet2". Let's also say A1 in Sheet1 could have one of four values: cat, dog, rabbit, mouse. Now, based on which value cell A1 on Sheet1 is, I need different rows hidden in Sheet 2. For argument sake let's say if cat is chosen rows 1-5 are hidden, if dog, 6-10 and so on.

View 5 Replies View Related

Insert Number Of Rows Based On Cell Values?

Feb 20, 2009

Column B contains geographical Areas. Column C contains a list of business departments.

North Env
North Env
North Ops
North Sales
North Sales
North Sales
South Env
South Maint
South Ops
South Sales
South Sales
South Sales

Etc.

The values and number of these departments will vary. I want to insert lines to sum the totals at the bottom of each geographic area based on the number of different departments. So, for this example, for the North three lines would be inserted. For the South, 4 lines would be inserted.

View 4 Replies View Related

Copy Rows Based On Comparing Values In Columns

Nov 26, 2012

I'm new to macros and VBA so I am wondering if it is possible for a macro to compare values in column B of sheet2 and column B of sheet3 and for the values that DON'T match i.e. unique values to column B of sheet2, copy row from sheet2 to sheet4? This will aid my processing time drastically if I can copy all the rows from sheet 2 to sheet 4 where the model number in column B of sheet 2 doesn't appear in column B of sheet 3!!

View 3 Replies View Related

Hide Rows Based On Values In A Cell Automatically

Apr 8, 2014

I am trying to hide rows based on values in a cell in that row. I have formulas in column xea that yields a 0 or 1 and I want to hide all rows with 0.

The code below works but I have to run the macro. I want it to happen automatically when the cell values change and I have not been able to figure it out.

Sub HideRows()
Application.ScreenUpdating = False
Application.Calculation = xlManual

For Each c In Range("xea1:xea350")

[Code] ........

View 9 Replies View Related







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