The following is a recorded macro:
Range("A5:E11").Select
Range(Selection, Selection.End(xlDown)).Select
Range("A61:E77").Select
Selection.Copy
Sheets("Sheet1").Select
Range("A1").Select
ActiveSheet.Paste
Sheets("[SHEET NAME]").Select
ActiveWindow.SmallScroll Down:=15
Range("A80:B88").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet3").Select
Range("A1").Select
ActiveSheet.Paste
Sheets("[SHEET NAME]").Select
ActiveWindow.SmallScroll Down:=12
Range("A91:J114").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Paste
Sheets("[SHEET NAME]").Select
I was wondering how to change the sheet name in capital letters so that the macro will run the same on any workbook. That is, how do I reference the sheet based on its location?
As a secondary and more complicated issue, the above code copies three tables to three separate worksheets. However, the number of tables and the size of those tables are variable. How can I tell Excel to stop highlighting a range once, say, two cells without text are found and at that point copy and paste the selected range a fixed number of cells out to a new sheet and name it based on the sheet it is coming from. Further, how can I make the macro move down after this until it sees text and then begin highlighting another table to copy and paste?