Category Archives: VBA Code

Preventing Worksheet Deletion without workbook protection

I have a Excel project where there is a workbook with “required” worksheets (users cannot delete them) but users can add / modify other sheets.  So the workbook structure cannot be protected, yet I have to make sure these required … Continue reading

Posted in VBA Code | Leave a comment

Copying Worksheets to Other Workbooks – Shapes causing unwanted links

I have a project that copies a series of worksheets from other files to a consolidation workbook.  After the consolidation workbook is saved and closed, when it is reopened, the following message appears: This workbook contains links to other data … Continue reading

Posted in Excel Tips, VBA Code | Leave a comment

Copying Worksheets from one Workbook to Another – Error 1004

I was working on a project using Excel 2010  where I had to copy entire worksheets from one workbook to another.  I was doing this through some vba code.  When I attempted to save the target file, I would get … Continue reading

Posted in Excel Tips, VBA Code | Leave a comment

VBA Code: IsFile — Does a file exist?

Here is some code to determine if a file exists.  Requires reference to Microsoft Scripting Runtime.  (Error handling is commented out). Function IsFile(sFileName) As Boolean ‘—————————————————————– ‘Purpose: Checks for the existence of a file based on path/name passed in. ‘ … Continue reading

Posted in VBA Code | Tagged | Leave a comment