The below code works fine only for the first time and when I try to rerun, it is not copying the sheets from source to destination. If I close the MsAccess DB and then reopen and execute it works again. Looks like some initialization problem. Can some one help me
Code:
Dim x, i As Integer x = 1
Wkb1.Activate
Dim CurSheet As String
CurSheet = Wkb1.ActiveSheet.Name
Do While x < RecordCount
Sheets(CurSheet).Activate ActiveSheet.Copy after:=Sheets(Sheets.Count)
ActiveSheet.Name = "Sheet" & x
x = x + 1
Sheets(CurSheet).Activate Loop