Formula for dropdown list

Solved/Closed
Report
Posts
11
Registration date
Wednesday September 16, 2009
Status
Member
Last seen
June 16, 2011
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-


n excel i want to use a drop lown list and when enter specified text, then next cell should display my specified formula, and for next drop down use next data

Plz dwnld sample file from below link.

https://authentification.site/files/22329930/for_example.xls

waiting for ur reply...

Vivek

1 reply

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
You would need to define event Worksheet_Change in the sheet where this drop down will be shown

Steps

1. Press ALT + F11
2. Press CTRL + R
3. Double click on the sheet where this calculation will occu



Private Sub Worksheet_Change(ByVal Target As Range) 
Dim myFormula As String 

    If Target.Column <> 2 Then Exit Sub 
     
    On Error GoTo End_Sub 
     
    Application.EnableEvents = False 
     
    Select Case Target 
     
        Case Is = "greecing" 
            myFormula = "=C" & Target.Row & " + 25000" 
             
        Case Is = "tyre change" 
            myFormula = "" 

         ' other cases go here


        Case Else 
            myFormula = "" 
             
    End Select 
     
    Target.Offset(0, 2).Formula = myFormula 
         
End_Sub: 

    Application.EnableEvents = True 
     
End Sub