PDA

View Full Version : Naming a selected range



chamster
09-02-2007, 10:54 PM
I get errors while running this code (despite the fact that the type of the selection indeed is Range). Why?


' the type is Range
MsgBox TypeName(Selection)
Dim sel As Range
' here i get an error
sel = Selection

rbrhodes
09-02-2007, 10:58 PM
Hi Chamster,

You need to use the 'Set' keyword for an object, eg a Range


Set sel = Selection