I am running Excel 2007 and writing code that some Excel 2003 users will run later.
I am trying out how to assign a variable to a selected range. Here is what I have so far. I keep getting and error on the line in red.
I will later be assigning the SRng variable to a listbox using the following:
I do not know if the above will work as I have not worked my way through debugging the code to the last example.
What I need help with at this time is assigning the variable.
Can someone please help me with the correct code?
Thank you,
Charles
I am trying out how to assign a variable to a selected range. Here is what I have so far. I keep getting and error on the line in red.
Code:
Dim SRng As Range
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
[COLOR="red"] SRng = Selection[/COLOR]
I will later be assigning the SRng variable to a listbox using the following:
Code:
UserForm1.ListBox1.RowSource = SRng
I do not know if the above will work as I have not worked my way through debugging the code to the last example.
What I need help with at this time is assigning the variable.
Can someone please help me with the correct code?
Thank you,
Charles