I have a feeling I am going to kick myself once this is pointed out to me...
I have written some lengthy code which does what I want, but I would like to "polish" it up, and get into good habits with using objects properly.
In the code below, I am happy that "a" is a variable which has been set to 10 for now, but can be changed later. "b" is a constant, and cannot be changed from its initial value of 25.
But... why does it not work with ranges?
I get the error "Expected: type name", and it's the red bit which seems to be causing the problem.
Bluto
I have written some lengthy code which does what I want, but I would like to "polish" it up, and get into good habits with using objects properly.
In the code below, I am happy that "a" is a variable which has been set to 10 for now, but can be changed later. "b" is a constant, and cannot be changed from its initial value of 25.
Code:
Dim a As Integer
a = 10
Const b as Integer = 25
But... why does it not work with ranges?
Code:
Dim c As Range
Set c = Range("A1:B4")
Const d As [COLOR=red]Range[/COLOR] = Range("A1:B4")
I get the error "Expected: type name", and it's the red bit which seems to be causing the problem.
Bluto