LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 177
Default How to keep a formula from being over written?

I want to create a UDF that when placed in a cell will create a validation
for that cell. The challenge is how to keep the UDF in the cell's formula
when the user makes a selection from the validation's drop-down list?

So for example, I might have a UDF

Function foo() As Variant
With Application.Caller.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:=xlBetween, Formula1:="a,b,c"
.InCellDropdown = True
End With
foo = "a" ' make sure the cell starts with a valid selection
End Function

So somebody can then type "=foo" into cell A1 to have the validation list
added.

However when the user makes a selection (e.g., b or c) from the validation,
I don't want to lose "=foo" as the formula.

Any suggestions?

TIA,

josh



 
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
Why is a formula written this way? Ross Excel Worksheet Functions 3 December 25th 08 07:45 AM
Identify if Cell is Formula or written number Claes G Excel Worksheet Functions 13 December 5th 07 05:01 PM
macro-written correct formula returns #NAME? and #VALUE? s.a. Excel Programming 4 April 9th 07 06:00 PM
Is there a formula to change number value to the written value? Ginny@apl Excel Discussion (Misc queries) 3 February 23rd 06 02:39 AM
Strange thing with this formula written by VBA [email protected] Excel Programming 1 July 1st 03 06:11 AM


All times are GMT +1. The time now is 11:33 AM.

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

About Us

"It's about Microsoft Excel"