Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Can you add formulas into drop boxes??

I'm wondering if excel has the capabilites to add different formulas to the
drop down boxes.
IE: option to choose between the sum of a number with different percentages
applied to the total...
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Can you add formulas into drop boxes??

Yes with a little help from VBA.

Say we have some value in A1 and we want to pick formulas from a dropdown to
go in B1.

Somewhere in the worksheet have a list of formulas:

'=A1*1.05
'=A1*0.1
'=A1*0.15

The single quotes (apostrophes) are important.

Set up data validation in B1 to point to this table. This will select one
of the three formulas (as text).

Finally in worksheet code, enter the following macro:

Private Sub Worksheet_Change(ByVal Target As Range)
' gsnuxx
If Not Intersect(Target, Range("B1")) Is Nothing Then
If Left(Target.Value, 1) = "=" Then
Application.EnableEvents = False
Target.Value = Target.Value
Application.EnableEvents = True
End If
End If
End Sub



The data validation pick the formua and the macro converts it from text into
a "real" formula.
--
Gary''s Student - gsnu200738


"AmieS" wrote:

I'm wondering if excel has the capabilites to add different formulas to the
drop down boxes.
IE: option to choose between the sum of a number with different percentages
applied to the total...

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
drop down boxes april Excel Discussion (Misc queries) 2 April 19th 07 10:11 PM
Drop down boxes Pasty Excel Worksheet Functions 4 October 30th 06 12:46 PM
drop down boxes stumakker Excel Discussion (Misc queries) 3 January 16th 06 01:42 PM
drop down boxes jayd77 Excel Discussion (Misc queries) 1 December 14th 05 04:48 AM
Drop Down Boxes Paula Excel Discussion (Misc queries) 0 April 20th 05 06:58 PM


All times are GMT +1. The time now is 03: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"