View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rod[_2_] Rod[_2_] is offline
external usenet poster
 
Posts: 19
Default Setting font properties using function

I want to be able to set the properties of a cell font using a function.
I have tried the below but it errors in the function with

Error Number: 91
Error Description: Object variable or With block variable not set

Anyone not on holiday out there who can help me please!

happy new year

Rod


------------------------
'Calling code

xlSht.Cells(1, 1).Font = NameFormatType1(255)


Private Function NameFormatType1(NmCol As Long) As Excel.Font

NameFormatType1.Color = RGB(NmCol, 0, 0)
NameFormatType1.Bold = True

End Function