tonywatsonhelp
Well-known Member
- Joined
- Feb 24, 2014
- Messages
- 3,194
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
Hi Everyone,
OK so i have a macro that runs to copy data from on one open document to another,
it works great but I want a safegauard that checks there are only two workbooks open the one with the macro and the one with the data to be copied
Now i have this code below, and it works great except some of use have our own Personal Workbook that stores macros so the check needs to be if personal is present check for 3 if not 2
any idea how i do this?
heres my code
OK so i have a macro that runs to copy data from on one open document to another,
it works great but I want a safegauard that checks there are only two workbooks open the one with the macro and the one with the data to be copied
Now i have this code below, and it works great except some of use have our own Personal Workbook that stores macros so the check needs to be if personal is present check for 3 if not 2
any idea how i do this?
heres my code
VBA Code:
If Application.Workbooks.Count > 2 Then
MsgBox ("Too many documents open.")
Exit Sub
End If