Excel interface to SQL

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

I have a Excel file with multiple worksheets on it, each worksheet is setup
with the same layout and is linked to other Excel files. I can select
multiple worksheets at one time by holding the "Ctrl" key while selecting
the worksheet. I need to save the data from the selected worksheet to a Sql
database. First, how do I write a "For...Loop" on the selected worksheet
using VBA in Excel, then how do I select some variables on a range of cell
value from the selected worksheet and pass on as a parameters to a Sql store
procedure. I am going to create a new button on the Excel main menu to
execute this. Thanks.
 
Hi,

can't help you with the SQL, but Excel has the following basic loop
structures:

1.

For Each sh in Worksheets

Next sh

2.

For I = 1 to 10

Next I

3.

Do While ActiveCell <>""

Loop

4.

Do Unti ActiveCell = ""

Loop

5.

Do

Loop While ActiveCell < 20

6.

Do

Loop Until ActiveCell > 10

7.

While Counter < 20


Wend

Add your own code between.
 
Back
Top