Union Function For Multiple Worksheets

Jun 1, 2007

I have two worksheets sheet1 & sheet2 in Workbook3 both get data from two different workbook1 & workbook2 using Microsoft Queries. Column Headers are same but contentes and no. of rows are different in these sheets. I would like to combine data from these sheets into sheet3 of Workbook3 so that i can create pivot table on that. I tried using Union Method, But it gave me "Run time error '1004'. Method 'Union' of object '_Application' failed in the following line

Set myMultipleRange = Application.Union(r1, r2)

Union method works fine when combining ranges from the same worksheet.

Multiple consolidation in Pivot table is not desirable to me as i have to group data using two columns and i could not get what i wanted using two page fields.

I have created named ranges for each sheet data. Is there an alternative to Union method for combining these named ranges from two worksheets into third sheet through VB code?

View 5 Replies


ADVERTISEMENT

With For Multiple Ranges (not Using Union)

Dec 29, 2008

Quick question: When using "With" is it possible to specify 2 ranges, or will I need to do 2 different with blocks? The reason I say not using Union is because I need my ranges seperate. I run 1 set of commands on Range 1, and 1 set of commands on both Range 1 and 2.

View 3 Replies View Related

Search Function Across Multiple Worksheets?

Apr 24, 2014

I have 6 worksheets with data. Column C of every worksheet is filled with unique Tracking Numbers.

I want to create a 7th worksheet with a search function. Users will be able to type in a Tracking Number (on cell A2), and information associated with that Tracking Number (from Columns A, D, E, F and G of worksheets 1-6) will show up beneath cell A2 on cells A4, B4, C4, D4, and E4.

View 3 Replies View Related

Using Countif Function For Multiple Worksheets

Jan 28, 2010

I am trying to use countif to count the number of times a unique items occurs in multiple worksheets.

For example, I want to count number of times "ITEM1" occurs in row 1 of sheets1, sheets2, sheets3, sheet4, etc. It may look like this:

Sheet1 = 4 entries
Sheet2 = 22 entries
Sheet3 = 5 entries
Sheet4 = 10 entries

So the entire count would be 41 total.

View 5 Replies View Related

Large Function For Multiple Worksheets

May 6, 2007

I am trying to use the 'large' function to input data from multiple spreadsheets, but am uncertain how to do so other than to use the same rows/columns in each and to use only continuous worksheets (that is, I want to enter data from worksheet 1,3,5 and different columns in each, for example).

View 4 Replies View Related

Lookup Function/Formula Across Multiple Worksheets

May 14, 2008

This formula works on 1 sheet but we are unable to make it work looking across multiple worksheets? Looking for a match to A3 in column G and wanting to pull the info from column E in the same row.

=IF('2'!G3:G271=A3, LOOKUP(A3,'2'!G3:G271,'2'!E3:E271),0)

View 8 Replies View Related

Copying Data From Multiple Worksheets To Multiple Worksheets In Another Workbook VBA

May 14, 2012

I have 2 nearly identical workbooks and I need to update historical data from the old workbook into the newer one.

My current Coding Snippets that I want to use look like the following:

Code:
Sub UpdateWorkbook()
Dim ws As Worksheet
Dim r1 As String
Dim r2 As String
Dim r3 As String
Dim r4 As String
Dim r5 As String
Dim r6 As String

[code]....

Now, this code isn't working I suspect because the Copy and PasteSpecial Functions don't work the way I wish to.

View 4 Replies View Related

Add To Selection By Right Clicking And Union

Jul 15, 2014

I'm trying to make a code so that when optionbutton1 is checked, it allows you to right click to select a cell, then right click on a different cell and select that cell as well as the previous cell, etc. Here's What I have so far.

[Code] .....

View 6 Replies View Related

Union Named Ranges

Apr 29, 2009

(Using Office 2003 on XP Pro) I have two named ranges that I want to union into one big named range so that I can use the big named range in a validation table. Unfortunately the big range does not appear on the list of named range so I switched to VBA to try and lick this but really I was hoping a non-VBA solution exists. Exploring possible VBA solutions, here is what I have so far:

View 6 Replies View Related

Union Ranges On Two Different Sheets

Mar 3, 2008

I'm trying to union two different ranges that exist on two different sheets and then copy the unique values into a third range with just the unique values. I was going to then use the unique range as my rowsource in a listbox. This is the code I was working with so far but i'm getting a compile error (method range of object failure).

Private Sub UserForm_Initialize()
Dim range4 As Range
Dim range3 As Range
Dim range2 As Range
Dim range1 As Range
Set range1 = Worksheets(1).Range("MyRange")
Set range2 = Worksheets(2).Range("MyRange2")
Application.Union(Range("range1"), Range("range2")).Select
Selection = range3
range3.AdvancedFilter Action:=xlFilterCopy, CopyToRange:=range4, Unique:=True
Me.lstone.RowSource = range4
End Sub

View 9 Replies View Related

Combining Multiple Cells In Multiple Worksheets In Multiple Workbooks Into One Table

Jan 6, 2009

I'm currently doing a survey using an excel workbook that contains multiple questions across multiple worksheets using radio buttons linked to certain cells.

I have around 400 workbooks coming back to me, so what i want to do is take specific values from across many worksheets within each workbook and combine them into a large master table in a seperate workbook.

I've tried using VBA, but not being very proficient at it i've hit a brick wall with that, so i'm hoping that there is an easier way to do it than what i'm currently pursuing.

View 9 Replies View Related

Selecting Ranges On Different Sheet Using Union

Nov 7, 2013

I am writing a UDF to find the average of two ranges, which start at the StartDate and then go back a certain number of days, that are on another sheet. When I use Union to try and unite my two ranges the resulting range just equals the first range.

VB:
Public Function ModifiedAverage(StartDate As Variant, SheetTenor As String, History As Double)
Dim DateRow, NbCols As Double
DateRow = Application.WorksheetFunction.Match(StartDate, Sheets(SheetTenor).Range("A:A"), 0)
NbCols = Application.WorksheetFunction.CountA(Sheets(SheetTenor).Range("6:6"))

[Code] ....

View 1 Replies View Related

Union Result Does Not Include Second Range?

Aug 15, 2014

I'm writing a function which includes the need to merge 2 ranges into 1 new Range object. The problem is that adding a breakpoint just after this occurs, and viewing the immediates, the new range only actually contains the first input range

For testing, and displaying here I've placed the 2 sub-Ranges into temp objects

[Code]....

The breakpoint is on the next line (not shown), so I can view all the Locals

tempyR1 and tempyR2 both are Range objects containing the correct Range data as expected from the code
However, objExcelRange only contains exactly the same as tempyR2

I'm using the Locals to check as this new combined Range will undergo further processing before being placed onto a sheet, and the combined Range will actually be generated dynamically depending on what options the user picks from a second sheet within the WorkBook - which could in fact be created from between 2 and 5 sub-Ranges

View 7 Replies View Related

Trying To UNION Same Cell And Blank Cells Possible?

Nov 12, 2012

I'm trying to select the same cell and a blank cell multiple with a UNION(). Is this possible?

Here's a summary of my code:

Code:
Dim c
Dim Rng As Range
Dim blankC As Range

Set blankC = Range("XFD1048576")

Code] ......

Ultimately, I'm trying to copy various cells and reorganize them including blank cells to conveniently use UNION for a quick copy and paste as opposed to explicitly defining where to paste everything.

View 9 Replies View Related

Checking If Selected Cells Is A Union

Aug 24, 2013

I would like to check if selected cells is a union of several ranges or one solid range. I am sure there is a way, but did not manage to find it. How to do it?

View 2 Replies View Related

Union Selection Without Looping Through Cells?

Apr 6, 2014

how one can union a selection without looping through the cells? I need to write a noncontinuous range into an array, and it can't be sorted as I'm using specialcells(xlCellTypeVisible).

View 1 Replies View Related

Loop Through Rows Of A Union Range

Aug 19, 2006

'How do I use a FOR NEXT loop on a union to just list all cell values in Col A?

'Just need a little help getting a handle on ranges and the union of ranges.
' This is my first time posting a question so any patience is appreciated.

Dim r1 As Range
Dim r2 As Range
Dim myMultipleRange As Range
Dim xCell As Range

Set r1 = Sheets("Sheet1").Range("A1", Range("A65536").End(xlUp))
Set r2 = Sheets("Sheet1").Range("B1", Range("B65536").End(xlUp))
Set myMultipleRange = Union(r1, r2)

r1.Select

For Each xCell In r1
'Ive been using this type of code to access anything I need from a sheet.
Debug.Print r1(xCell.Row, 1), r1(xCell.Row, 2), r1(xCell.Row, 3)
Next xCell...............

View 9 Replies View Related

Object Required: Union Method

Nov 9, 2006

columnA contains account numbers sorted in ascending order i need to use the union method to select all rows where the account number changes so that later i can insert rows between different account numbers in one action. i tried to use the following code but an error occurs stating 424 object required ....

View 7 Replies View Related

Union Range Comprised Of Two Cells On Worksheet

May 19, 2014

I am trying to create a union range that is comprised of two cells that are no where near each other on a worksheet. I keep getting the object required error. Everything else works perfectly.

Dim myRng As Range
Set myRng = Application.Union((Range("IndData1")), (Range("IndData2"))).Activate
Do Until ActiveCell = ""
Selection.Copy

[Code] .....

View 1 Replies View Related

Problem With Union Method: Combining Two Ranges

Oct 7, 2008

I have the following two ranges in the same spreadsheet: A1:A1000 and B1:B1000. Both contain data that I would like to manipulate. Let's assume I would like to add "1" to every cell in the two ranges. This is what I have so far:



Sub Test2()
Dim wb As Workbook
Dim ws1, ws2 As Worksheet
Dim rng1a, rng1b, rng_union As Range
Set wb = ThisWorkbook
Set ws1 = wb.Worksheets("testsheet")
Set ws2 = wb.Worksheets("result")
ws1.Select
Set rng1 = Range(Cells(1, 1), Cells(1000, 1))
Set rng2 = Range(Cells(1, 2), Cells(1000, 2))

Set rng_union = Union(rng1, rng2)...................

Function ADDONE(rng)
n = rng.Cells.Count
ReDim rng_add(1 To n)
For i = 1 To n
If rng(i) = "" Then GoTo NextIndex
rng_add(i) = rng(i) + 1.............
End Function
I have to somehow combine the two ranges because the data needs to be manipulated simultaneously. Instead of having the range of results returned to me (see worksheetfunction.transpose), I could have calculated the variance, average etc... of the results, too. I'm using the transpose function to show that the operations in function ADDONE are only conducted for the first range of cells (rng1) that I have joined with the union method. I presume that Union might not be the correct method but I don't know ehich other method to use.

View 9 Replies View Related

Chart Source Data: Union Of Every N Cell

Sep 19, 2006

I have 4 sheets. In each sheet, I have a column of data for every hour of every day of one year.

In the 1st worksheet, I want to make a chart using :

- for Y values : the average of the data for each day
- for X values: the day

In the 3 other worksheets,
- for Y values : the data for each hour
- for X values: the hour

To make it more simple, I will first build in the "D" column the data of the average data for each day (so, every 24 columns)

Here is my

Dim lNbSheet As Long ' sheet number
Dim rSheetData As Range ' what will be my Y values
Dim rSheetTime As Range ' what will be my X values
Dim sSheetName As String ' current sheet

For lNbSheet = 1 To 4

'selection of the Y values
Sheets(lNbSheet).Select
sSheetName = ActiveSheet.Name

I get the error "methode SeriesCollectiosn of Object _chart failed;

Also, if you have an idea that could make me avoid writing all the new average-for-the-day data in column D (using it directly),

View 8 Replies View Related

Finding The End Of Rows And Columns And Taking Union Of Sets

Jun 13, 2013

I have a code in software that exports results to excel. But it stores the numbers associated with indices as text. I need to change all of them to numbers. So I have written the following code, that search through the folder, converts text to numbers and colses the file.

Sub ConvertText2NumberFiles()
Dim v As Variant
Dim rng1 As Range, bk As Workbook
Dim i As Long
ChDrive "C"
ChDir "C: ...analysis"

[Code]....

The problem is it takes time becuase it is going through A LOT OF cells. I only need at most the first 4 columns and the first 2 rows. So I wanted to use the union. I wrote the following:

Set IndexColumns = bk.ActiveSheet.Range(Columns("A") & ":" & Columns("A").SpecialCells(xlLastCell))
Set IndexRows = bk.ActiveSheet.Range(Rows("1") & ":" & Rows("1").SpecialCells(xlLastCell))
Application.Union(Range("IndexColumns"), Range("IndexRows")).Select

Which doesn't work! Morover it is only for one column and one row.

NOTE1 : Like any matrix, the intersection of index columns and index rows is blank!
NOTE2 : The lenght of indices is different from one file to another

View 2 Replies View Related

Create Pivot Table Based On Union Query

Jul 2, 2010

I created a union query in Access to join two tables (Projections and Actual Sales). The query produces the results I want. I need to create a pivot table in Excel using the union query as the source. When I pull up the data import function in Excel, the union query does not appear. Do I need to do something else? I have tried to create a select query where I select all from the union query and I can find that fine.

When I use this query to create the pivot table the results end up all zeros when I try to sum the values. It creates some crazy results when I show it as count of also.

I can provide the data in either the Access database or Excel spreadsheet.

View 4 Replies View Related

Excel 2007 :: Union Of Values In 2 Columns To One In Increasing Order?

Jul 20, 2012

I have to find the union of 2 columns in excel and club those 2 columns into a single column with values in the increasing order.eg: column 1- 0 2 4.. , column 2- 1,3,5.. final result in column 3 should be 0 1 2 3 4 5...plz let me know the code for this that i can run in VB editor(- excel 2007)

View 9 Replies View Related

Excel 2007 :: Copy Multiple Unique Values To Multiple Worksheets

Aug 26, 2013

I have an Excel Spreadsheet (2007) that contains over 500,000 records that shows Electric meter usage per month over a 24 month period per meter. What I want to be able to do is to select a meter row per number and copy is to it's own worksheet. At the end - I want to be able to have a seperate worksheet per electric meter number - that I can create a graph. If I go through all 9000 meters and copy and paste into a different worksheet - it will take me weeks to do manually. How can I do this automatically?

View 1 Replies View Related

Consolidate All Data In Multiple Worksheets Of Multiple Workbooks In One Master File?

Jul 12, 2014

I need a macro that would consolidate all data in multiple worksheets of multiple workbooks in one Master file.

All the workbooks will be in one particular folder. The macro should search for data in all the workbooks and consolidate it in one master excel workbook.

I am currently using both excel 2007 and excel 2010. This macro would really reduce manual work as currently consolidating data from 45 to 50 sheets takes an ample amount of time...

View 4 Replies View Related

Excel 2010 :: Create Macro Button To Clear Multiple Cells On Multiple Worksheets?

Jul 2, 2014

I have attached a test workbook excel 2010 (ignore ref# errors, I've cut the workbook down for uploading purposes) What I would like to do is have a 'Button' on my 'information Sheet' which when clicked would clear certain cells. I have searched the forum but can't find a solution, everyone seems to want to delete rows or columns but I just want to clear certain cells. The workbook will have 11 sheets each named 'caravan 1' through to 'caravan 11' The uploaded test workbook only only has 3 sheets.

On 'caravan 1' (which is slightly different to the other 10) I want to clear the content of cells

B4 & B5
C4, C22 & C41
D4 & D5
E4,E5, E22,E23,E41 &E 42

On all other 'Caravan sheets' I want to clear the contents of cells

D4 & D5
E4, E5, E22, E23, E41 & E42

It would be icing on the cake if it could give a warning such as " are you sure you want to clear these cells" but that isn't really necessary. The worksheets will be password protected, but the cells mentioned above will not be. If it proves too difficult to clear all the cells on all the sheets with one click, then perhaps a simpler solution might be to have a button on each sheet instead

View 8 Replies View Related

Copying Multiple Columns From Multiple Worksheets To Summary Worksheet

Jul 28, 2013

I'm making a Excel list for trading cards (MTG) and I've divided it into different worksheets in order to sort it by the color of the cards (not really important I guess).

The issue I have is that I want it to copy certain columns (in this case C3:C1000, F3:F1000, G3:1000 ) from almost all of the worksheets into a new worksheet where it should paste them into column A, B and C.

In two of the worksheets it's also different (C3:C1000 , G3:G:1000, H3:H1000).

I've seen many where you copy one range from multiple worksheets, and that would've been okay I guess if not those two worksheets were different. I'd prefer not to change them, and I'd also prefer if I could've gotten just the information I needed also. Is this possible to do?

View 5 Replies View Related

Email Multiple Worksheets To Multiple Recipients In One File Per Recipient?

Mar 27, 2014

I'm trying to email multiple worksheets from a list to multiple recipients in a list, but in one file per person. In a sheet called "Email list", for example, I have a list of 50 worksheet names (e.g. one for each cost centre) in column A (with a heading in cell A1, if that's OK, so the list starts in A2) and in columns B-F up to 5 recipients for each worksheet (e.g. 3 recipients might be 2 supervisors and their manager).

Also, each manager and supervisor might also receive several sheets.

Although columns B-F are presently free-format (they can be anyone's email address, regardless of whether they're a supervisor or manager), it might be easier to split these columns so B,C,D are supervisors emails and E,F are managers, if that makes it any easier creating the collated file of worksheets..?

Unfortunately the recipients might change occasionally so they can not be hard keyed into the macro itself (which would be much easier), but need to be in a table so it's easier for the user to update and maintain - in the past, I've managed to hard key the requirement into a macro which I've maintained (by recording and editing the macro), but I don't know the VB to figure this new request.

Ideally, I am trying to create a macro that can collate the various worksheets each person will receive and send the selected sheets in one file to that recipient, rather than multiple files within one email and/or multiple emails.

View 8 Replies View Related

Move Multiple Columns From Multiple Worksheets Into 1 Column

Aug 18, 2007

I have an excel workbook with 8 worksheets. Each worksheet has vertical columns (approx 250 columns per sheet) of numeric data. Is there a function or macro that will combine all of this data into one vertical column without having to individually cut and paste each one into the new column?

View 3 Replies View Related







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