View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Excel MVP Don Guillett Excel MVP is offline
external usenet poster
 
Posts: 168
Default Macro to combine worksheets

On Jul 1, 6:52*am, AB wrote:
This would then also clear the Master up:

Sub CombineWorksheets()

* * Dim ws_Master As Worksheet

* * On Error GoTo CreateMasterSheet:
* * * * Set ws_Master = ThisWorkbook.Worksheets("Master")
* * On Error GoTo 0

* * ws_Master.Cells.ClearContents

* * 'the rest of all your code.

ExtSub:
* * On Error GoTo 0
* * Exit Sub
CreateMasterSheet:
* * ThisWorkbook.Worksheets.Add.Name = "Master"
* * Resume

End Sub


"If desired, send your file to dguillett @gmail.com I will only look
if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results."