Greetings all,
I have a project that I am working on that involves the creation of several macros within one workbook. The goal is to provide a central workbook that can be accessed by any staff member and based upon the source file selected for a data matching task, the associated macro can be applied. The purpose of the macros is to provide preparatory formatting, move the contents of Sheet1 to Sheet2 and rename both sheets.
I was able to create the macros using the Personal.xlsb method and all seemed fine when I ran the first macro. As soon as I either "save" or close and re-open, the workbook breaks with any of several errors. I have received "400 Visual Basic" errors that say nothing else but what is in quotes, another Microsoft Visual Basic error of "Run-time error '9': Subscript out of range". Below is the macro that is resulting in the run-time error 9 so if anyone can shed some light on whether or not I am going about this the right way or perhaps a better solution is available I would be very appreciative. FYI, the macro below pertains to a file containing 7881 rows.
Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
Sub Lanyon_Pre()
'
' Lanyon_Pre Macro
'
'
Columns("B:H").Select
Selection.Delete Shift:=xlToLeft
ActiveWindow.SmallScroll ToRight:=3
Columns("H:M").Select
Selection.Delete Shift:=xlToLeft
ActiveWindow.LargeScroll ToRight:=-1
ActiveWindow.SmallScroll ToRight:=2
Sheets.Add After:=Sheets(Sheets.Count)
Sheets("MMT_PropertyList").Select
Cells.Select
Range("C1").Activate
Selection.Cut
Sheets("Sheet1").Select
ActiveSheet.Paste
Sheets("MMT_PropertyList").Select
Sheets("MMT_PropertyList").Name = "ICE"
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Lanyon"
Range("B21").Select
End Sub
Bookmarks