Copy Rows Where No Blanks In Specific Column

Sep 14, 2009

I have the attached a workbook (& the code) which merges the worksheets from 7 different workbooks together into a 'Raw data' worksheet in my master workbook. It is driven off a parameters table which allows you to select which workbooks/worksheets you want to include in the merge. - The code works fine however when it is copying the data from each worksheets it is just copying all the data as a 'block' copy where I need it do do it row by row becuase I dont want to copy the row if colum C in each row contains no data, ie. it is blank.

So in my code I need another loop which will: Copy data from column A - E for each row if column C is not blank. Paste into Column B - F in Raw Data worksheet (as column A contains the source filename) Loop until it reaches no more data. I adeeally just want to copy the specific range as above, not the whole row but either will do. This is my code, refer to attachment too which includes master workbook and an data entry workbook where the data comes from.

Sub OpenWorkbooks()
Dim Book_Name As range ' List of available books
Dim Sheet_Name As range ' List of available sheets
Dim dLastRow As Long
Dim oLastRow As Long
Dim sLastRow As Long
Dim DestinationSheet As Worksheet
Dim SourceSheet As Worksheet
Dim WorkBookList As range
Dim WorkSheetList As range
Dim WorkbookPath As String
With Application
. ScreenUpdating = False
.DisplayAlerts = False
.EnableEvents = False
End With
'set source and destination sheet
Set DestinationSheet = Sheets("Raw Data")
Set SourceSheet = Sheets("Parameters")........................

View 5 Replies


ADVERTISEMENT

Copy Specific Rows With Column That Varies?

Jul 14, 2014

I have these specific rows (2,3,4,6,43,44,45,63) which I would like to copy and paste it on a designated sheet. But my problem is, the column varies depending on the YEARS.

I do have codes for it, the one I got from the recording. I just do it for all of the rows (formula pasted here) until all of it copied on the summary sheet. However, when I finally finished it and I run it. I could see the movement form One Sheet to another and its not good.

A code that I could use for my better understanding of MACRO.

View 3 Replies View Related

Copy Rows If Specific Text In Column A

Jan 27, 2014

I have some specific procucts in coloum A in sheet (data), If that product was found in Sheets("allproducts"), copy all the rows and create a new sheet on the product name and save the excel.

Sub SearchForString()

Dim LSearchRow As Integer
Dim LCopyToRow As Integer

On Error GoTo Err_Execute

'Start search in row 1
LSearchRow = 1

[Code] ....

Err_Execute:
MsgBox "An error occurred."

End Sub

View 2 Replies View Related

Copy Rows If Specific Text In Column A?

Jan 27, 2014

I have some specific procucts in coloum A(a2, a3, a4, till a50) in sheet (data), If that product was found in Sheets("allproducts"), copy all the rows and create a new sheet on the product name and save the excel.

[Code] .....

View 2 Replies View Related

Count Column W/blanks & Values Based On Specific Date

Nov 25, 2009

I am in desperate need of a function that will count a column of data where there are blanks and values based on a certain date that will also capture any data that is added after refreshing the table from Access. I have tried several functions but this is what I have: =(ROWS('TouchBack Detail'!$Q:$Q)*COLUMNS('TouchBack Detail'!$Q:$Q))+(COUNTIFS('TouchBack Detail'!$B:$B,'Nov TouchBack Summary'!B$1)). The result should be 3 but it’s including all other cells in the column that are not and should not be included in the refreshed table’s data (Table_TouchBack.accdb). I have attached the spreadsheet for review. The function is in cell B27 highlighted in yellow.

View 3 Replies View Related

VBA Code To Copy And Paste To Specific Rows Based On Matching Column Header?

Dec 7, 2011

I have a spreadsheet and I was wondering if there is a way to copy from a specific range in say A1:A5 in Sheet1 and paste into Sheet2 where the column matches cell A1 in Sheet1.

I am trying to do this in VBA and I was wondering if there is a way to do this.

View 9 Replies View Related

Copy Data Sets Seperated By Blanks Rows

May 8, 2008

I have an excel file which contains 2 set of data. 1 with 14 rows and other with 20 rows. These are randomly distributed in the sheet and are abut 1000 of data set in a sheet with a combination of 14 and 20 row data set. Data is separated by blank rows, i.e. if it is 14 row data set it would have a blank after 14th row and similarly a blank after 20th row for a 20 row data set. Following the blank another data set starts which might be of 14 or 20 again. I have attached a sample sheet for reference.

View 5 Replies View Related

Copy Cells To Adjacent Column, Removing Blanks

Dec 8, 2009

In a worksheet, J2:J52 contains a list of unique strings; each cell populated by an embedded formula. Some of the cells contain a valid 'blank' "" given by the formula.

I'd like K2:K52 to contain the values J2:J52, with all the populated cells stacked at the top and the 'blank' cells at the bottom. 'Blank' cells do not have to be in any particular order.

I've been fiddling with the formula kindly provided by WindKnife on the second post in the thread below for the past couple of hours, but to no avail:

http://www.excelforum.com/excel-work...om-a-list.html

Columns A:H in the same worksheet are populated and unavailable for use.

View 8 Replies View Related

Copy Cells To Empty Column Each Time And Remove Blanks

Oct 24, 2008

Is there way i can have a macro attatched to a button that when clicked, will copy BX:BX on sheet1, remove all the blank cells and put it on D:D on sheet2. Next time it is clicked, it will put BX:BX on to the next available column after removing the blanks and so on, filling a column at a time on sheet2?

If the above is easy, it would be really good if it could paste into columns until it reaches column H and then go back to D again but paste below the data already there, then E, but below, etc. I think though that the last bit is asking a bit much and is just cosmetic and easier to print, so dont worry too much.

View 9 Replies View Related

Create Column List Out Of Table (rows And Columns) While Removing Blanks

May 26, 2014

I am trying to create a straight column list that can take the rows and columns of a table, and list only the nonblank items. The formula I am using only seems to work with one column, not multiple.

Formula:

[Code] .....

View 12 Replies View Related

Delete Rows With Specific Characters In A Specific Column

Dec 10, 2007

Currently I am using the Kickbutt VBA Find Function of Aaron, but I would like to have something that works more efficiently. What I currently do is (assuming all possible values for Column J are A - F):

Find_Range("A", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("B", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("C", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("D", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("E", Columns("J"), MatchCase:=True).EntireRow.Delete

although I just want some code that says: delete all rows except those that have "F" as content in Column J. I already tried something like:

Range("1:65536").Select
For Each cl In Range("J:J")
If cl.Text = "A" Or cl.Text = "B" Or cl.Text = "C" Or cl.Text = "D" Or cl.Text = "E" Then
Rows(cl.Row).Delete
End If
Next

but it also takes much to long. The major problem I think, is that the number of records is variable so I search the entire worksheet...

View 5 Replies View Related

Finding Rows With Specific Characters - Copy Only Those Rows

Apr 7, 2012

I'd like to be able to search a spreadsheet for a specific word or series of characters. Once all of the ROWS that contain the characters are found, I'd like to be able to have another spreadsheet with ONLY those rows (all columns).

View 8 Replies View Related

Alter Existing Formula To Copy Specific Cells In Row Instead Of Copy Entire Column?

May 1, 2014

I need the macro to look at cells B9:B84 on the Sheet1 tab of the Cost Template. If it finds an x I need it to copy the 3 cells to the right of the x and paste them in a template. For example if it sees an x in cell B9 it would copy cells C9, D9 and E9, open the Purchase Order to the Detail tab, then paste it to cells B3, C3 and D3. It would continue looking for an x down to B84. So if it found 5 cells with x, it would give me 5 instances of the Purchase Order with 3 cells pasted into each.

I've attached my Cost Template and the Purchase Order it needs to copy to. In the Cost Template is a macro called Create_PO. This is what I was trying to alter to make this happen. I can't seem to get it right! FYI in case it matters, I had to change the Cost Template from .xltm to .xlsm in order to upload it on this site.

View 11 Replies View Related

Copy Rows To Different Sheet Starting At Specific Row

Jun 19, 2013

I use the following code to copy entire rows from one sheet to another and this is pretty standard.

VB : rng.EntireRow.Copy Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)

Assuming that Sheet2 is blank, this of course copies the rows to Sheet2 starting at Cell A2 and down column A. I would like to modify the code so that I can specify at which row the copy should start. For example, I might want to start the copy at A1 instead of A2, or at A10 instead of A2.

View 5 Replies View Related

Copy / Paste After Specific Number Of Rows

Jul 18, 2013

I have a code which is copy/pasting the selection specified number of times

VB:
Sub CopyNtimes()
Dim i
For i = 1 To Application.InputBox("How many times do you want to copy the selection?", "", 1, Type:=1)
With Selection
.Copy .Offset(i * .Rows.Count)
End With
Next
End Sub

How to modify this code so that it can paste the selection specified number of times leaving specified number or rows

For Example:

Selection is A1:Z10
need to copy paste 2 times...
Rows to leave: 3

So it should paste in the range A14:Z24 and then A28:Z38

View 5 Replies View Related

Formula To Copy To Values To Specific Rows

Nov 15, 2009

Column A lists an account code on the summary line of each invoice. I'd like to copy this account code upwards for each individual line of the invoice so that I can summarise each type of charge by account code in a pivot table.

I'm a bit stumped as to how to do it. If possible I don't want to have to modify the data itself in any way so that I can paste new data in the each day without altering it.

I've started on the right with a CountA function for each row, which I was intending as a means to identifying the blanks rows and discount them, but it also showed up that each line requiring an account code to be copied returns a 4 and each invoice summary line returns a 9. I'm just not sure how to reflect this in a function.

View 4 Replies View Related

Copy/Paste Rows With Specific Values

Sep 4, 2006

I have workbook "Sheet1" that has many rows and columns with values. Could I have code to find the cells value "plant2300" in column A and copy all the rows in column A that has the cell value "2300" into workbook Sheet2 (also copy with headers from Sheet1 to Sheet2 row 1).

View 3 Replies View Related

Formula To Copy Some Rolls To Specific Rows In Another Worksheet

Nov 12, 2008

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.

View 2 Replies View Related

Moving Rows Into Specific Column

Sep 10, 2009

I need to move a number of rows, based on user input
in front of the first column, continuously until it 'flattens out' into one row..
And then do the procedure again for the next row
Kinda hard to explain.. maybe i'll use an example
using this matrix :

View 8 Replies View Related

Search Through Rows Of Specific Column

Jul 28, 2013

I am trying to develop a macro that does the folllowing

1) Takes the value from a specified column of a sheet in the workbook and sequentually go the the values of that column and compares those values to another sheet in the workbook

For ex: sheet1 in column A row 1 has string value abc123 and sheet2 column A row 1 has value 123abc. I want to compare these two values from different sheets.

2) However if the values don't match I would like to take the value from sheet1 and see if it is in the list on sheet2.

3) If the value from sheet2 isn't on the list from sheet1 then paste that row information to sheet3

So far this is what I have. All it does now is go through both lists and compares the values but I am not sure how to single out those values for conditional formating. I am sure that the singled out values will need to be derived dynamically since I won't know what or when the values will be up for conditional formatting.

Dim LoopCount As Integer
Dim RangeCount As Integer
Dim CellVal As String
Dim CellIncrement As Integer
Dim ErrorCount As Integer
Dim PasteConfirm As Boolean

[Code] .........

View 1 Replies View Related

Move Rows With Anything In Specific Column

Dec 16, 2007

I am working on the attached price proposal and need my user to be able to enter a number into column E indicating that that row should be printed on the quote. The 'quote' can be new sheet or another area of current sheet that is formatted to look like letterhead.

View 4 Replies View Related

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

4) repeat requirement 3 till no more Scenario's

View 14 Replies View Related

Macro To Copy Rows Containing Specific Blank Cells To Another Workbook

Jan 30, 2013

I have spreadsheet of data, I need to extract any rows that have blanks cells in columns F or P or T.

If possible I would like a macro I could run that would cut all of the rows that meet the above criteria and paste them in to a separate sheet.

View 2 Replies View Related

2003 Delete Rows With Specific Value In Column C

Apr 13, 2009

I need a code that will go thru column C and delete the whole row if cell value is 78315, Also it needs to shift the the rows up so there is no empty rows wheneverything is done done. I used some codes but they take forever to go thru whole sheet.

View 4 Replies View Related

VBA / Delete All Rows That Contain Certain Values In A Specific Column

Mar 8, 2012

Is there a VBA code I can use that will delete all rows that contain "ABC" or "YXZ" or "HHH" in column A ?

View 2 Replies View Related

Highlight Rows After Specific Text In Column?

Dec 7, 2012

I have a 14 column report with a dynamic range of rows. In Column A, there will only be one cell that contains the text "Added Sections:".

I need to highlight, 10 whole rows up to the 14th column, after the cell that contains "Added Sections:".

View 6 Replies View Related

Insert X Rows After Specific Cell Value In Column

Aug 20, 2009

I have a dataset that i want to update, to do this I want to insert 8 rows after each row that has a value in Column C 2000. The set has 600,000 rows, comparing countries (cty, cty2) from 1980-2000. I want to make room for information up till 2008. I see lots of codes for doing this but I will also need help with actually inserting into my spread sheet.

View 3 Replies View Related

Selecting Rows With Specific Values In A Column

Jan 11, 2005

I'm attempting to write a macro that will select all the rows which contain a value in a specific column. Say for example, all the instances of "test" in column C, I need to select the entire row with that value in the column.

I should also mention that by using an autofilter, only specific row numbers are selected. The source spreadsheet is dynamic and will not always display the same value in the same row, and thus I need something a little more adaptable.

View 9 Replies View Related

Delete Rows With Specific Text In A Column

Apr 16, 2008

I want to delete any/all rows from a worksheet (named UK) which have the word "VAN" in column P. I have tried using a 'For Each... Next statement' in a macro, but always get a debug box "Run Time Error '91' Object variable or With block variable not set". What am I doing wrong? my code follows

Sheets("UK").Select
Dim cell As Range
For Each cell In Worksheets("UK").Range("P10:P200").Cells
Cells. Find(What:="VAN", _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False).Activate
Selection.EntireRow.Delete
Next

View 3 Replies View Related

Count Rows Including Blanks Omitting Hidden Rows

Apr 18, 2013

I have data in B4:B55 and need a formula to return a count of rows, including rows that are blank. However, there are hidden rows that need to be omitted from the count.

View 1 Replies View Related







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