Hello
this code works with simple data and three sheets, but what I want to make it fast by make dealing with about at least 9000 rows for each sheet and increase sheet to become about 20 sheets at least.
the code will show all of data across sheets and exclude row contains OPENING word in column C and row contains TOTAL word in column A.
currently code is too slow with big data.
I hope somebody can reproduce this code to make fast it.
this code works with simple data and three sheets, but what I want to make it fast by make dealing with about at least 9000 rows for each sheet and increase sheet to become about 20 sheets at least.
the code will show all of data across sheets and exclude row contains OPENING word in column C and row contains TOTAL word in column A.
currently code is too slow with big data.
VBA Code:
Sub LoadData()
Dim s$(1), x, e
For Each e In Array("Mussala", "mssau", "mjhgsg")
s(0) = s(0) & IIf(s(0) = "", "", "Union All (") & "Select " & _
"Format(`DATE`,'dd/mm/yyyy'), `INVOICE NO`, `TYPE`, `DEBIT`, `CREDIT`, " & _
"`BALANCE` From `" & e & "$` Where `TYPE` <> 'OPENING' And `TYPE` Is Not Null " & IIf(s(0) = "", "", ") ")
Next
s(1) = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" & ThisWorkbook.FullName & _
";Extended Properties='Excel 12.0;HDR=Yes';"
With CreateObject("ADODB.Recordset")
.Open s(0), s(1), 3, 3, 1
x = .GetRows
End With
With Me.ListBox1
.ColumnCount = UBound(x, 1) + 1
.Column = x
For i = 0 To .ListCount - 1
.List(i, 3) = Format(.List(i, 3), "#,##0.00")
.List(i, 4) = Format(.List(i, 4), "#,##0.00")
Next i
End With
End Sub