Hello. This is a very very basic question about variables in range names.
I have quite a few ranges of varying lengths in multiple Excel documents. I want all the ranges standardized and set to the same length, but I don't know what that length will be yet, and it may change, so I'd like to make a variable for it.
This is currently the best I've come up with:
Sub FixEverything() Dim sh As Worksheet For Each sh In Worksheets sh.Visible = True Next Dim OutLim As Integer OutLim = 200 ActiveSheet.Names.Add Name:="RangeNameHere", RefersTo:="=$A$3:$B$OutLim" ' One of these lines per named Array Worksheets(2).Visible = Hide Worksheets(4).Visible = Hide Worksheets(6).Visible = Hide Worksheets(8).Visible = Hide End Sub