Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting #NAME? errors with functions

Status
Not open for further replies.

DougGordon

IS-IT--Management
Jun 29, 2011
1
AU
Hi

I am fairly new to VBA so excuse my newbee question. Ihave a function that works on one notebook in Excel 2007 that doesn't seem to work on another machine running the same SOE.

The function is:

Public Function colorfont(ActiveCell) As Double
colorfont = ActiveCell.Font.Color
End Function

When I call this in Excel as =Colorfont(A1) I get an error "#NAME?" - but I have tried to resolve this and can't.

I know this is probably what is covered the most elemenary VBA course, but I just can't get past this.

Thanks for you time.

Doug
 



hi,

Not ActiveCell!
Code:
Public Function colorfont(rng as range) As Double
    colorfont = rng.Font.Color
End Function


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top