ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   What is the quickest way to copy codes in Sheets? (https://www.excelbanter.com/excel-programming/301732-re-what-quickest-way-copy-codes-sheets.html)

Bob Phillips[_6_]

What is the quickest way to copy codes in Sheets?
 


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Anson" wrote in message
...
I have wrote some codes to copy the modules and forms from the one

workbook to another. Most of them worked fine, but the sheets modules were
turned into class modules. I know I could manually enter the exact lines
from the sheets and have the macro to wirte it, but is there a way to copy?

This is the section that deals with coping modules:

'---------------------------------------------------------------------------
------
Dim NewBook As Workbook
Dim VBComponent As VBIDE.VBComponent, ModName As String

'Copy Modules
ModName = ThisWorkbook.Path & "\Merit Worksheet Code.txt"
For Each VBComponent In ThisWorkbook.VBProject.VBComponents

VBComponent.Export ModName
NewBook.VBProject.VBComponents.Import ModName
Kill ModName

Next VBComponent





All times are GMT +1. The time now is 07:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com