Krishna20 New Member Dec 15, 2013 #1 Hi, If I have goven a variable as range does it act as an array? For example Dim a as Range a = Range("A5:Z5").Select Now if i want to select D5, can this be given a(4) ? Thank you
Hi, If I have goven a variable as range does it act as an array? For example Dim a as Range a = Range("A5:Z5").Select Now if i want to select D5, can this be given a(4) ? Thank you
Hui Excel Ninja Staff member Dec 15, 2013 #2 Krishna Firstly, Welcome to the Chandoo.org Forums Your code won't work as it is written You can do something like: Code: Dim a As Range Set a = Range("A1:Z1") Debug.Print a(4).Value 'This prints the value of D1 in the Intermediate window You can then use Code: a(4).Select 'This selects the 4th cell in a to select the 4th element in a
Krishna Firstly, Welcome to the Chandoo.org Forums Your code won't work as it is written You can do something like: Code: Dim a As Range Set a = Range("A1:Z1") Debug.Print a(4).Value 'This prints the value of D1 in the Intermediate window You can then use Code: a(4).Select 'This selects the 4th cell in a to select the 4th element in a