Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Function for RowHt. How to create

Hi All,
I would like to create a function to get the row height. Eg in cell B5
it should put the value of row B height. similar to =Cell("width") so
that if i type =RowHt() it should put the row height value in the
activecell.
Many Thks
KZ

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Function for RowHt. How to create


Public Function RowHt() As Double
RowHt = ActiveCell.EntireRow.Height
End Function

note that adjusting the row height will not cause the cell to recalculate..
just like Cell("width") when getting the column width.

--
Hope that helps.

Vergel Adriano


"Kieranz" wrote:

Hi All,
I would like to create a function to get the row height. Eg in cell B5
it should put the value of row B height. similar to =Cell("width") so
that if i type =RowHt() it should put the row height value in the
activecell.
Many Thks
KZ


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Function for RowHt. How to create

One way:

Public Function RowHeight(Optional ByRef rng As Range) As Variant
Application.Volatile
On Error Resume Next
If rng Is Nothing Then Set rng = Application.Caller
On Error GoTo 0
If Not rng Is Nothing Then
RowHeight = rng.EntireRow.Height
Else
RowHeight = CVErr(xlErrRef)
End If
End Function

Called as

=RowHeight()

it returns the height of the active row, or you can reference another
cell/row:

=RowHeight(E7)

returns the height of Row 7.


In article om,
"Kieranz" wrote:

Hi All,
I would like to create a function to get the row height. Eg in cell B5
it should put the value of row B height. similar to =Cell("width") so
that if i type =RowHt() it should put the row height value in the
activecell.
Many Thks
KZ

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Function for RowHt. How to create

On Apr 16, 8:18 pm, Vergel Adriano
wrote:
Public Function RowHt() As Double
RowHt = ActiveCell.EntireRow.Height
End Function

note that adjusting the row height will not cause the cell to recalculate..
just like Cell("width") when getting the column width.

--
Hope that helps.

Vergel Adriano





"Kieranz" wrote:
Hi All,
I would like to create a function to get the row height. Eg in cell B5
it should put the value of row B height. similar to =Cell("width") so
that if i type =RowHt() it should put the row height value in the
activecell.
Many Thks
KZ



Many thks
Rgds
KZ

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Function for RowHt. How to create

On Apr 16, 8:25 pm, JE McGimpsey wrote:
One way:

Public Function RowHeight(Optional ByRef rng As Range) As Variant
Application.Volatile
On Error Resume Next
If rng Is Nothing Then Set rng = Application.Caller
On Error GoTo 0
If Not rng Is Nothing Then
RowHeight = rng.EntireRow.Height
Else
RowHeight = CVErr(xlErrRef)
End If
End Function

Called as

=RowHeight()

it returns the height of the active row, or you can reference another
cell/row:

=RowHeight(E7)

returns the height of Row 7.

In article om,





"Kieranz" wrote:
Hi All,
I would like to create a function to get the row height. Eg in cell B5
it should put the value of row B height. similar to =Cell("width") so
that if i type =RowHt() it should put the row height value in the
activecell.
Many Thks
KZ



Many thks, Mr McGimpsey. Exactly what i wanted. Qn What does
application.caller do? and CVErr(xlErrRef)
Rgds
KZ



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Function for RowHt. How to create

Did you look at "Caller property" and "CVErr Method" in XL/VBA Help?



In article .com,
"Kieranz" wrote:

Qn What does
application.caller do? and CVErr(xlErrRef)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a function FrozenRope Excel Worksheet Functions 2 November 25th 08 12:20 AM
Trying to create a certain function chas Excel Worksheet Functions 3 December 26th 06 09:02 PM
Create a new function... NWO Excel Programming 8 September 2nd 06 06:20 PM
Create Function like Sum() Yap Michael Excel Programming 1 January 13th 06 04:12 AM
How do I create a function into function list? Hossein Farhani Excel Programming 2 April 23rd 05 06:19 PM


All times are GMT +1. The time now is 06:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"