M
michael.beckinsale
Hi All,
Below is a snippet of code that l have used many times in my current
workbook (with the exception of the first line which l have put in for
testing purposes) to set / rename ranges.
The problem is that l have a dynamic named range which is used to
populate the row source of a combo box on a user form. Hence l need to
call this code each time the form adds a new record.
The code does what it says, deletes existing & creates new. Problem is
that the user form then does not recognise the row source. If l
manually delete the named range and manually recreate the user form
recognises it!
The named range is used on different sheet to where it resides and l
have checked that it has global properties
Any help greatly appreciated
Sub resetrnIL()
Dim ILR
ActiveWorkbook.Names("rnInternal_Locations").Delete
Sheets("Internal Locations").Visible = True
Sheets("Internal Locations").Select
Columns("J").Hidden = False
Range("J2").Select
ILR = Range(Selection, Selection.End(xlDown)).Address
ActiveWorkbook.Names.Add Name:="rnInternal_Locations", _
RefersTo:="=Internal Locations!" & ILR
Columns("J").Hidden = True
End Sub
Regards
Michael beckinsale
Below is a snippet of code that l have used many times in my current
workbook (with the exception of the first line which l have put in for
testing purposes) to set / rename ranges.
The problem is that l have a dynamic named range which is used to
populate the row source of a combo box on a user form. Hence l need to
call this code each time the form adds a new record.
The code does what it says, deletes existing & creates new. Problem is
that the user form then does not recognise the row source. If l
manually delete the named range and manually recreate the user form
recognises it!
The named range is used on different sheet to where it resides and l
have checked that it has global properties
Any help greatly appreciated
Sub resetrnIL()
Dim ILR
ActiveWorkbook.Names("rnInternal_Locations").Delete
Sheets("Internal Locations").Visible = True
Sheets("Internal Locations").Select
Columns("J").Hidden = False
Range("J2").Select
ILR = Range(Selection, Selection.End(xlDown)).Address
ActiveWorkbook.Names.Add Name:="rnInternal_Locations", _
RefersTo:="=Internal Locations!" & ILR
Columns("J").Hidden = True
End Sub
Regards
Michael beckinsale