Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am using Excel 2003 on Windows Vista
I have a file of London fare data. (Shows fares between origin and destination stations.) It consists of about 600 rows and columns. Because Excel 2003 only supports 256 columns in a sheet, I need to split my data over more than one sheet. The data ought to be symmetrical and mostly is. However, I have found one pair of stations where the AB price and BA price are different. It takes several elapsed days to assemble that file from the Internet. I would like to identify asymmetric data to assess the extent of that asymmetry. i.e. I assume AB price = BA price is probably correct. I want to assemble an "array" in memory. I can read data from a single sheet with code like this: Dim PricesA_D As Variant PricesA_D = Sheets("A-D").Range("B2", _ Sheets("A-D").Cells.SpecialCells(xlCellTypeLastCell).Address ) ' The first row and column contain station names I think I need a picture. Sheets("A-D") might start Abbey Wood Acton Central Acton Main Line ... Abbey Wood X 1.23 2.34 Acton Central 3.21 X 3.45 Acton Main Line 2.34 3.45 X .... I have shown asymmetric data between Abbey Wood and Acton Central. Sheets("E-K") station names might start Ealing Broadway Ealing Common Earls Court ... Abbey Wood Acton Central Acton Main Line .... I want an "array" in which the E-K data is appended to the A-D data. I tried Dim Prices As Variant Prices = Application.Union( _ Sheets("A-D").Range( "B2", _ Sheets("A-D").Cells.SpecialCells(xlCellTypeLastCell).Address ), _ Sheets("E-K").Range( "B2", Sheets("E-K").Cells.SpecialCells(xlCellTypeLastCell).Address ), _ Sheets("L-R").Range( "B2", Sheets("L-R").Cells.SpecialCells(xlCellTypeLastCell).Address ), _ Sheets("S-Z").Range( "B2", Sheets("S-Z").Cells.SpecialCells(xlCellTypeLastCell).Address )) I got Run-time error '1004': Method 'Union' of object '_Application' failed I assumed that was because Union tries to create a sheet with more than 256 columns. To test that assumption, I tried Prices = Application.Union( _ Sheets("A-D").Range("B2", "T20"), _ Sheets("E-K").Range("B2", "T20")) but got the same error. 1) Why does Union get 1004? 2) How do I construct a large "array" with minimal coding? 3) After Dim PricesA_D As Variant PricesA_D = Sheets("A-D").Range( _ "B2", _ Sheets("A-D").Cells.SpecialCells(xlCellTypeLastCell).Address ) Locals shows StationsA_D has Type Variant/Variant(1 to 623, 1 to 151) What code will find those values 623 and 151 in StationsA_D? My original problem of finding asymmetric data can easily be solved by comparing cells on my 4 sheets. I want to be able to process copies of sheet data in memory. -- Walter Briscoe |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help using the LARGE function "WITHOUT" using an array | Excel Worksheet Functions | |||
Using the functions "LARGE"and "SMALL" in an Excel program | Excel Programming | |||
Listbox header inside VBA (Array("Head1", "Head2", ...) | Excel Programming | |||
If changed array formula reduce ""\""\""\ - signs to #Missing, will it make ... | Excel Programming | |||
Utility to "clean up" or "defrag" large Excel file | Excel Discussion (Misc queries) |