N
Need Help Fast!
What I am trying to do, is call on array and go down it and use these values
for another part of my macro. Everything works fine but this. Here is the
code.
Option Explicit
Private mcnToDatabase As Connection
Private mwksResults As Excel.Worksheet
Private Const STATE_FIPS_COL = 0
Private Const COMMODITY_COLUMN = 1
Private Const PRACTICE_COL = 2
Private Const CS = "Provider=Microsoft.Jet.OLEDB.4.0;User
ID=Admin;Mode=Share Deny None;Jet OLEDB:Engine Type=4;Data Source="
Private Const CLIENT_TAB = "CLIENT"
Private Const ALT_TAB = "ALT1"
Public Sub Run(dbPath As String)
Dim lDataRow As Long
Dim lData As Long
Dim GetAllData As Variant
Dim asData As String
ConnectToDatabase dbPath
Set GetAllData = asData()
'Stuff in Main that opens Excel
For lDataRow = 0 To UBound(asData(0))
Main asData(lDataRow, STATE_FIPS_COL), asData(lData, COMMODITY_COLUMN),
asData(lData, PRACTICE_COL)
'RunSolver
'Save as new workbook
Next lDataRow
End Function
It keeps giving me an error and saying "expected array". It says the array
isn't there, but it is. It's in the worksheet15. So if anyone can help it
would be greatly appreciated. Can someone tweak my code or something? Thanks
for another part of my macro. Everything works fine but this. Here is the
code.
Option Explicit
Private mcnToDatabase As Connection
Private mwksResults As Excel.Worksheet
Private Const STATE_FIPS_COL = 0
Private Const COMMODITY_COLUMN = 1
Private Const PRACTICE_COL = 2
Private Const CS = "Provider=Microsoft.Jet.OLEDB.4.0;User
ID=Admin;Mode=Share Deny None;Jet OLEDB:Engine Type=4;Data Source="
Private Const CLIENT_TAB = "CLIENT"
Private Const ALT_TAB = "ALT1"
Public Sub Run(dbPath As String)
Dim lDataRow As Long
Dim lData As Long
Dim GetAllData As Variant
Dim asData As String
ConnectToDatabase dbPath
Set GetAllData = asData()
'Stuff in Main that opens Excel
For lDataRow = 0 To UBound(asData(0))
Main asData(lDataRow, STATE_FIPS_COL), asData(lData, COMMODITY_COLUMN),
asData(lData, PRACTICE_COL)
'RunSolver
'Save as new workbook
Next lDataRow
End Function
It keeps giving me an error and saying "expected array". It says the array
isn't there, but it is. It's in the worksheet15. So if anyone can help it
would be greatly appreciated. Can someone tweak my code or something? Thanks