C
cedtech23
I am trying to reuse the code below
Code:
--------------------
Public Function ColorBorder(chgcell As String)
Range(chgcell).Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 3
End With
end Function
--------------------
It will work the first time but if I run it again
I get the following error
method 'range' of object'_global' failed
I read somewhere that I have to
Modify the code so that each call to an Excel object, method, or
property is qualified with the appropriate object variable. But I don't
have a clue what that means are how to do it.
I think the line I have to edit is Range(chgcell).Select
Can someone help me out? thanks
Code:
--------------------
Public Function ColorBorder(chgcell As String)
Range(chgcell).Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 3
End With
end Function
--------------------
It will work the first time but if I run it again
I get the following error
method 'range' of object'_global' failed
I read somewhere that I have to
Modify the code so that each call to an Excel object, method, or
property is qualified with the appropriate object variable. But I don't
have a clue what that means are how to do it.
I think the line I have to edit is Range(chgcell).Select
Can someone help me out? thanks