Row Height Function

  • Thread starter Thread starter Steve S
  • Start date Start date
S

Steve S

Hey all... I can't figure out what I'm doing wrong here.
Please help!

I have the following under the 'This Workbook' in VBEditor:

Function RowHeight() As Double
RowHeight = Application.Caller.RowHeight
End Function

Then, in the worksheet, I've entered =RowHeight() and I
get the dreaded #NAME? error. Any quick responses would
be incredibly helpful. TIA
 
Hi
a function can't change the formating of a cell or change the Excel
environment. So what you're trying to achieve is not possible. Sorry

In addition you have to enter your user defined functions in a standard
module and not in 'ThisWorkbook'. Insert a new module in the VBA editor
and enter your code in this standard module. You may also have a look
at
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
You should put this in a regular code module (in the VBE:
Insert/Module). In general, ThisWorkbook and worksheet class modules
should be used for event macros.

The ThisWorkbook module is a workbook-class module. If you, for some
reason, want to leave the code there, you need to prepend the class name:

=ThisWorkbook.RowHeight()
 
Hi
sorry
I misread your function Thought you'e trying to set the row height.
Just put your code in a standard module and it should work.
 
Frank Kabel said:
a function can't change the formating of a cell or change the Excel
environment. So what you're trying to achieve is not possible. Sorry

The function wasn't changing anything, just returning the row height.
In addition you have to enter your user defined functions in a standard
module and not in 'ThisWorkbook'. Insert a new module in the VBA editor
and enter your code in this standard module. You may also have a look
at
http://www.mvps.org/dmcritchie/excel/getstarted.htm

You don't have to enter UDFs in standard modules, but if you use
Workbook or worksheet code modules, you need to prepend the class name,
just like any other class macro.
 
JE McGimpsey said:
Sorry

The function wasn't changing anything, just returning the row height.

Je
saw this after sending the message :-)
Need more coffee, I think <vbg>

Frank
 
Back
Top