D
Dave B
I'm trying to copy the sheets in one workbook into another workbook
using VBA, but I get an error when I try
Sub MergeWorkbooks(strBook1 As String, strBook2 As String)
Dim ws As Worksheet
For Each ws In Workbooks(strBook2).Sheets
ws.Copy Before:=Workbooks(strBook1).Sheets(1)
Next ws
End Sub
Both workbooks are opened when I call them. Any ideas? Thanks.
using VBA, but I get an error when I try
Sub MergeWorkbooks(strBook1 As String, strBook2 As String)
Dim ws As Worksheet
For Each ws In Workbooks(strBook2).Sheets
ws.Copy Before:=Workbooks(strBook1).Sheets(1)
Next ws
End Sub
Both workbooks are opened when I call them. Any ideas? Thanks.