I have a workbook, UserFileBook, that contains the Name 'Version' which simply refers to a number (it does not refer to any range, in the Name Manager it just 'Refers to =5'). I am trying to compare this number with the version number of a different workbook. When I had UserFileBook's 'Version' as an actual named range (it referred to cell C1 which had the value of 5 in it) everything worked fine. But IdiotUser can edit that value or delete it right on the sheet, so I made it just refer to a number so it can only be edited through the manager. Is there a way for me to obtain the value of that Name and alter it from another WB now? Currently I'm trying this:
Sub CheckVersionNumber(Vers As Long)
'Checks to see if this version is compatible with the UW version
Dim wb As Workbook
Set wb = UserFileBook
Dim UWVers As Long
UWVers = wb.Names("Version").Value 'Breaks here
'Version information is in the range "Version" on UW
If UWVers < Vers Then
GoTo LowerVersion
Else
If wb.Names("Version") > Vers Then 'tried this originally and also breaks, also if .Value is added
GoTo UpperVersion
End If
End If
Exit Sub
I also tried comparing to wb.Range("Version"), and even wb.Worksheets("Sheet 1").Range("Version) but those didnt work either. How can I reference (and alter) the value of "Version" in the USerFileBook if it doesn't refer to a range?