Hello all,
A new employee screwed up and saved a file over our macro. Luckily, I had an older version saved, but unluckily, it's not working right and I don't know code well enough to figure out why it's not doing what it needs to do.
Where it's broken is that when it copies the headers to the permlrg file, all the data below B1:O1 is disappearing. Below is the code, tell me if you need where my problem might be. Thanks!
Sub BENEFITAR5()
'
' BENEFITAR5 Macro
'
'
ChDir "G:\DOWNLOAD"
Workbooks.OpenText Filename:="G:\DOWNLOAD\Permlrg.xls", Origin:=437, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=False _
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), _
Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1), _
Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1)), _
TrailingMinusNumbers:=True
Columns("K:K").Select
Rows("2:68").Select
Selection.Delete Shift:=xlUp
Cells.Select
ActiveWorkbook.Worksheets("Permlrg").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Permlrg").Sort.SortFields.Add Key:=Range("N2:N58") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Permlrg").Sort
.SetRange Range("A1:N58")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Columns("A:A").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.ColumnWidth = 22.43
ChDir "G:\Templates\BENEFITS"
Workbooks.Open Filename:="G:\Templates\BENEFITS\BENEFIT AR HEADERS.xlsx", _
Origin:=xlWindows
Range("A9:A16").Select
Selection.Copy
Windows("Permlrg.xls").Activate
Range("A1").Select
ActiveSheet.Paste
Windows("BENEFIT AR HEADERS.xlsx").Activate
Range("A1:G1").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Permlrg.xls").Activate
Range("P1").Select
ActiveSheet.Paste
Sheets("Permlrg").Select
Sheets("Permlrg").Name = "ORIG"
Sheets("ORIG").Select
Columns("A:A").EntireColumn.AutoFit
Windows("BENEFIT AR HEADERS.xlsx").Activate
Windows("BENEFIT AR MACRO.xls").Activate
End Sub
Thanks!
Bookmarks