Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to create a function | Excel Worksheet Functions | |||
Trying to create a certain function | Excel Worksheet Functions | |||
Create a new function... | Excel Programming | |||
Create Function like Sum() | Excel Programming | |||
How do I create a function into function list? | Excel Programming |