Formula for dropdown list

Solved/Closed
love2garv Posts 11 Registration date Wednesday September 16, 2009 Status Member Last seen June 16, 2011 - May 8, 2010 at 08:13 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - May 8, 2010 at 08:44 AM


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 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
May 8, 2010 at 08:44 AM
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 

0