Dim sh As Worksheet
Dim sSql as String

'Your existing connection code, but the rs.Open will go in the loop

For Each sh In ThisWorkbook.Worksheets

sSql = "SELECT * FROM " & sh.Name
rs.Open sSql, cn

r=3
Do While Not IsEmpty(sh.Range("A" & r))
With rs
'Your existing code for AddNew and Update
End With
Loop

rs.Close
Set rs = Nothing
Next sh

That's the rough skeleton. Post back if you need some details.

--
**** Kusleika
Excel MVP
Daily Dose of Excel
www.*****-blog.com

bhellsun wrote:
> Thanks for the reply.
> How do I loop through all the sheets ??
> Yes your right there is a relation between the sheets and the tables.
> The name of the table is the same as the sheet.
> And I have 9 different sheets and corresponding tables.
> Can you give me a rought idea about the code.