I am having issues when calling the name of the variable to save the new file as xlsb.
This is for a new master file I'm working for in Excel. I already tried with the real name of the file I'm using, but when I declare it as a variable, an error keeps popping up
Option Explicit
Dim roster As String
Sub DisplayRegion()
Dim SpecificArea As String
SpecificArea = ActiveCell.CurrentRegion.Select
With Selection
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
End Sub
Sub roster_conversion(roster As String)
'
' roster_conversion Macro
'
'
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Sheets("Sheet1").Select
Range("A1").Select
Workbooks.Open Filename:=roster
Sheets("Sheet1").Select
Rows("1:1").Select
Selection.Delete Shift:=xlUp
DisplayRegion
Workbooks(roster).SaveAs Filename:="Roster", FileFormat:=50
Workbooks(roster).Close SaveChanges:=True
Windows("Control.xlsm").Activate
Sheets("Sheet1").Select
Range("A1").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
Sub roster_calling()
roster = "C:\Users\ricardo.delgado\Downloads\Global L&D Roster Report.xlsx"
roster_conversion roster
End Sub
I expect the code to run smoothly as it was before. Now I am declaring the file inside a variable, and it keeps giving me the Subscript out of range error. Could you guys help me?