CsJHUN
Active Member
- Joined
- Jan 13, 2015
- Messages
- 360
- Office Version
- 365
- 2021
- 2019
- Platform
- Windows
- Mobile
Hi guys, i have this (snipet):
this should open a write protected shared workbook on lan (the dblink value in a cell) loop thru every sheet and copy the data on that sheet to macroworkbook (thisworkbook) "Allrequest" sheet, and... (the rest is not important i guess).
The problem is:
in the for loop the "Sheet(i).activate" select the sheet in thisworkbook and not the database.
Ideas?
Cheers
John
Code:
Private Sub readreqdb()
Sheets("allrequest").Activate
ActiveSheet.Unprotect Password:="asdqwe"
dblink = Sheets("settings").Range("AG11").Value
Workbooks.Open dblink, ReadOnly:=True, Password:="asdqwe"
Set reqdb = ActiveWorkbook
For i = 1 To Sheets.Count
Sheets(i).Activate
asn = ActiveSheet.Name
lraas = Range("A" & Rows.Count).End(xlUp).Row
....
The problem is:
in the for loop the "Sheet(i).activate" select the sheet in thisworkbook and not the database.
Ideas?
Cheers
John