Union only works for sometimes.
Shu wrote:
Set rngFrom = Sheets("SUMMARY").Union(R1, R2, R3, R4)
I am surprised that this ever works
a) Union is not a method of a sheet but of the Application
b) it is not referenced from xl
I would expect
Set rngFrom = xl.Union(R1, R2, R3, R4)
However, I think the procedure could be simplified down to
Private Sub Command0_Click()
Dim xl As Excel.Application
Dim xlwb As Excel.Workbook
Dim xlst As Excel.Worksheet
Dim tempFile As String
Set xl = CreateObject("Excel.Application")
xl.Visible = True
tempFile = "G:\RSBL Template2.xls"
Set xlwb = xl.Workbooks.Open(tempFile)
Set xlst = xlwb.Worksheets("SUMMARY")
With xlst.Columns(1)
.Resize(,4).Copy
.Insert
End With
End Sub
Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup
|