I use a program called OmniPage, which converts various formats to, in this case, Excel 2010. The only real problem is that it puts each sheet of the document in a separate sheet of the workbook. Obviously, consolidating a 100 page workbook into one sheet is very time-consuming.
I tried to automate it through a macro:
Sub Macro1()
'
' Macro1 Macro
' To consolidate sheets from Omnipage
'
Sheets("Sheet2").Select
Range("A1").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Sheets("Sheet1").Select
Range("A10").Select
Selection.End(xlDown).Select
Range("A56").Select
ActiveSheet.Paste
Sheets("Sheet2").Select
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.Delete
End Sub
This works fine for the second sheet.
The problem is that it references Sheet2. Once the sheet-delete code runs, the reference becomes invalid.
Im sure this can be done through incrementing a variable, but I dont know how to do it.
Any help would be appreciated.
TIA
Old
↧