LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Alternative to updating 300,000 links in Excel 2000?

Alternative:

Probably fastest way is to use ADO to read the workbook's sheets
and dump the data into 1 new workbook or mdb. Mdb is probably
fastest solution (if you're going to use Pivots anyway :)

You could use linked tables in access.. but ...


Just to give you an idea of HOW fast ADO can be..
I copied this little thingy which consolidates 1000 files
into 1 database in no time...

guess how long? .. now run the routine and be amazed


Create new workbook.. put some dummy data in, and save it as
data0000. in a new directory.

edit the path constant.. to point to the directory :)
Then run the routine which creates 1000 copies for testing.
Then run the tstPump to see how fast it consolidates things...

Option Explicit
'Code needs a reference to Microsoft ActiveX Data Objects 2.5 or higher)

Const PATH = "d:\phone"

Sub CreateTestXLS()
Dim i
ChDrive PATH
ChDir PATH
For i = 1 To 1000
FileCopy "data 0000.xls", "customer " & Format(i, "0000") & ".xls"
Next
End Sub

Sub CreateNewMDB(FileName As String)
Dim ocat As Object
Set ocat = CreateObject("ADOX.Catalog")
ocat.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Jet OLEDB:Engine Type=5;Data Source=" & FileName
End Sub

Sub tstPump()
Dim t!, i%
t = Timer
If Dir(PATH & "\data.mdb") = "" Then CreateNewMDB PATH & "\data.mdb"
MDBDropDump
For i = 1 To 1000
XLS2MDB PATH & "\customer " & Format(i, "0000") & ".xls"
Next
MsgBox "done in " & Format(Timer - t, "0") & " seconds."

End Sub

Sub MDBDropDump()
Dim cnn As ADODB.Connection
Const cnnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
PATH
& "\data.mdb" & ";"

Set cnn = New Connection
cnn.Open cnnString
cnn.CursorLocation = adUseClient
On Error Resume Next
cnn.Execute ("DROP TABLE DUMP")
cnn.Close

End Sub


Sub XLS2MDB(sXlFile$)
Dim cnn As ADODB.Connection

Const cnnString = "Provider=Microsoft.Jet.OLEDB.4.0;Extended
Properties=""Excel 8.0;Header:YES"";Data Source=&FFFF;"

Set cnn = New Connection
cnn.Open (Replace(cnnString, "&FFFF", sXlFile))
cnn.CursorLocation = adUseClient
On Error GoTo errH
cnn.Execute "INSERT INTO dump IN 'd:\phone\data.mdb' select '" & _
Left(sXlFile, Len(sXlFile) - 4) & "' as Client , * from `sheet1$`"

endH:
cnn.Close
Exit Sub

errH:
If Err.Number = -2147217865 Then
'This creates the table..
cnn.Execute "select '" & Left(sXlFile, Len(sXlFile) - 4) & _
"' as Client , * INTO dump IN 'd:\phone\data.mdb' from `sheet1$`"
else
msgbox err.number & vbnewline & err.description
End If
GoTo endH

End Sub



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Steve wrote :

Hi,

I am using Excel 2000. I have a workbook with about 30 worksheets.
Each worksheet has an identical layout containing 14 sections every
45 rows with a number of empty rows and cells. I am using coumns A
through S. The columns I want to use are in column A and B, and G
through S. It is model forecasting volume, revenue, expense (months
in G:S and year in S).

Right now these I have linked these 30 worksheets into a single
worksheet in a separate workbook, the purpose for which is to
organize my data in tabular form so that I can create a pivot table.

Updating the links in 15,000 rows and 19 columns is much too slow in
Excel 2000. I am wondering if there is a macro available I could use
to copy and paste value the data i need.

I could record a macro to do this, but I am wondering if there is a
better way.

For example, if I recorded the macro, I would tell it to in worksheet
1, copy A6:B6 and paste value in new workbook sheet, copy and paste
G6:S6A6:B6, copy paste A12:B18, copy paste E12:S18, copy paste
A20:B33, copy paste G20:S33, and so on, until all my data is repasted
into a tabular format in the new workbook.

Thanks very much.

I've read
http://j-walk.com/ss/excel/tips/tip82.htm

and

http://www.google.com/groups?hl=en&l...1La.4495%24cJ5.
436%40www.newsranger.com&rnum=6

but I am not sure how to make these work for my situation.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Countifs in Excel 2000? Alternative solution sought!!! Lisa Excel Discussion (Misc queries) 3 March 30th 10 12:20 AM
re Alternative to updating 300,000 links in Excel 2000? Mark E. Philpot Excel Programming 0 July 22nd 04 10:17 AM
Alternative to links for updating worksheet? Steve Excel Programming 0 July 21st 04 10:10 PM
Writing a macro to change external links to manual updating in Excel 2000 John Wirt[_5_] Excel Programming 6 February 16th 04 08:03 AM
Updating Links in Excel Danny[_4_] Excel Programming 2 November 19th 03 02:32 PM


All times are GMT +1. The time now is 10:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"