Parameterization Required for this macro

sathyaanil37

New Member
Joined
Sep 14, 2012
Messages
32
Hi Team,

Actually I gone through the below code it is working file,It will connect to database and retrieve table results in sheet.
Here we are providing table name in Sqlquery so it is picking only that table details(table1)
Instead of that using the same code it will take table names that is present in sheet1 from A1 to A6 and give the results of those tables data in another sheet.
Code:
 Dim strSQL As String
 Dim strResult As String
 Dim OraDynaSet As Object
 Dim i As Integer
 Worksheets.Add
 strScript = "select tablenames, OWNER from ALLTABLES  group by tablenames where tablenames in('table1')

  Set OraDynaSet = objDataBase.DBCreateDynaset(Script, 0&) 

 If OraDynaSet.RecordCount > 0 then
        OraDynaSet.MoveFirst
        For i = 1 to OraDynaSet.RecordCount
                ActiveSheet.Cells(i,1) = OraDynaSet.Fields(0).Value 
        ActiveSheet.Cells(i,2) = OraDynaSet.Fields(1).Value
        OraDynaSet.MoveNext
    Next i
 End if
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,214,422
Messages
6,119,395
Members
448,891
Latest member
tpierce

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top