Quantcast
Channel: Microsoft forum - dslreports.com
Viewing all articles
Browse latest Browse all 8524

[Excel] VBA question

$
0
0
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. I’m sure this can be done through incrementing a variable, but I don’t know how to do it. Any help would be appreciated. TIA Old

Viewing all articles
Browse latest Browse all 8524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>