Thread: macro help
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Jim Cone
 
Posts: n/a
Default macro help

jason,
Maybe something like this...

'----------------------------------
Function WhackAMole() As Double
Dim strName As String
Dim dblValue As Double
Dim dblAnswer As Double
strName = Range("B1").Text
dblValue = Range("H1").Value2

Select Case strName
Case "2pack"
dblAnswer = dblValue / 4
Case "3pack"
dblAnswer = dblValue / 15
Case "4pack"
dblAnswer = dblValue / 15
'enter as many more as you need...
Case Else
dblAnswer = 0
End Select

WhackAMole = dblAnswer
End Function
'------------------------------------
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"jwfakouri" wrote in message
hey guys'
need help writing this formula as a macro, i need to nest an
infinite number of
packs
=IF(B1="2pack",H1/4,IF(B1="3
packl",H1/15,IF(B1="4 pack",H1/15,"not")))

thanks
jason
jwfakouri