![]() |
Setting A Default Value
I am trying to figure out a way to set a default value. For example:
In a code like: Function WS(rng As Range) As String WS = "The name of the worksheet is " & rng.Worksheet.Name & "." End Function If no argument is inserted I want the rng of the active cell to be considered. -- Best Regards, Faraz |
Setting A Default Value
Hi Faraz
Try the below Function WS(Optional rng As Range) As String If rng Is Nothing Then Set rng = Application.Caller WS = "The name of the worksheet is " & rng.Worksheet.Name & "." End Function If this post helps click Yes --------------- Jacob Skaria "Faraz A. Qureshi" wrote: I am trying to figure out a way to set a default value. For example: In a code like: Function WS(rng As Range) As String WS = "The name of the worksheet is " & rng.Worksheet.Name & "." End Function If no argument is inserted I want the rng of the active cell to be considered. -- Best Regards, Faraz |
Setting A Default Value
Wow Jacob,
Sure do need a friend like you to teach me such skills. Any free recommended ematerial on net for VBA? Please do see if you can email me at . Sure do seek to become a Jacob myself. Thanx in advance PAL!!! -- Best Regards, Faraz "Jacob Skaria" wrote: Hi Faraz Try the below Function WS(Optional rng As Range) As String If rng Is Nothing Then Set rng = Application.Caller WS = "The name of the worksheet is " & rng.Worksheet.Name & "." End Function If this post helps click Yes --------------- Jacob Skaria "Faraz A. Qureshi" wrote: I am trying to figure out a way to set a default value. For example: In a code like: Function WS(rng As Range) As String WS = "The name of the worksheet is " & rng.Worksheet.Name & "." End Function If no argument is inserted I want the rng of the active cell to be considered. -- Best Regards, Faraz |
All times are GMT +1. The time now is 01:51 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com