Rip1971
Board Regular
- Joined
- Nov 3, 2020
- Messages
- 65
- Office Version
- 365
- Platform
- Windows
Hi,
I would like to put a error handling code taht does the following. in my code i have this line. this works well if the srcWS is already open. But when i do not have the file open i would like a msg telling me to open the file. or even better a (don't know how it is called) but a explore window so i can locate and open the file which is then used as srcWS.
Since the code is started from the active workbook is the order in which this is done important??
thanks in advance
I would like to put a error handling code taht does the following. in my code i have this line. this works well if the srcWS is already open. But when i do not have the file open i would like a msg telling me to open the file. or even better a (don't know how it is called) but a explore window so i can locate and open the file which is then used as srcWS.
Since the code is started from the active workbook is the order in which this is done important??
VBA Code:
Sub CopyDepartement(control As IRibbonControl)
Application.ScreenUpdating = False
Dim LastRow As Long, r As Long
Dim srcWS As Worksheet, desWS As Worksheet
Dim Ary As Variant, Nary As Variant
Set srcWS = Workbooks("Bewonerslijst.xlsx").Sheets("Sheet1")
Set desWS = ActiveWorkbook.Sheets("Data")
thanks in advance