Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default 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

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
setting default filter setting tpeter Charts and Charting in Excel 0 December 4th 09 02:50 PM
Setting Up Default Behavior PZ Excel Discussion (Misc queries) 4 February 24th 07 03:56 AM
Setting default printer using wsh PO Excel Programming 3 February 14th 05 07:09 PM
Setting default pivot table field setting to "sum" Mr. Moose Excel Discussion (Misc queries) 2 December 21st 04 04:43 PM
Setting default Tab Name Cameron[_2_] Excel Programming 3 July 31st 03 11:02 PM


All times are GMT +1. The time now is 06:05 PM.

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"