Using the Worksheet_Change event, you can do the following, this assumes that your Data Validation List is in cell B1 and you want the results in C1:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ws As Worksheet: Set ws = Sheets("Sheet1")
Dim CustomNumber As Variant
If Target.Address = "$B$1" Then
Select Case ws.Range("B1").Value
Case "A"
ws.Range("C1").Formula = "=1+1"
Case "B"
ws.Range("C1").Formual = "=1+2"
Case "C"
ws.Range("C1").Formula = "=1+3"
Case "D"
ws.Range("C1").Formula = "=1+4"
Case "E"
ws.Range("C1").Formula = "=1+5"
Case "Custom"
CustomNumber = InputBox("Please enter a custom number", "Custom")
If IsNumeric(CustomNumber) Then
ws.Range("C1").Formula = "=1+" & CustomNumber
Else
MsgBox "Please enter a number", vbCritical = vbOKOnly
Exit Sub
End If
End Select
End If
End Sub
EDIT:
As per comments I've updated my answer to have only two Cases, either using a Custom number or using the value returned by a formula, this assumes your lookup formula is in A1, amend your code as required:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ws As Worksheet: Set ws = Sheets("Sheet1")
Dim CustomNumber As Variant
If Target.Address = "$B$1" Then
Select Case ws.Range("B1").Value
Case "Custom"
CustomNumber = InputBox("Please enter a custom number", "Custom")
If IsNumeric(CustomNumber) Then
ws.Range("C1").Formula = "=1+" & CustomNumber
Else
MsgBox "Please enter a number", vbCritical = vbOKOnly
Exit Sub
End If
Case Else 'if your lookup formula is in A1, then the code below will add one to the value from the formula
ws.Range("C1").Formula = "=1+" & Val(ws.Range("A1").Value)
End Select
End If
End Sub
UPDATE:
Following OP's further comments I've updated the code to include the lookup value returned by the formula:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ws As Worksheet: Set ws = Sheets("Sheet1")
Dim CustomNumber As Variant
If Target.Address = "$B$1" Then
Select Case ws.Range("B1").Value
Case "Custom"
CustomNumber = InputBox("Please enter a custom number", "Custom")
If IsNumeric(CustomNumber) Then
ws.Range("C1").Formula = "=1+" & CustomNumber
Else
MsgBox "Please enter a number", vbCritical = vbOKOnly
Exit Sub
End If
Case Else 'if your lookup formula is in A1, then the code below will add one to the value returned by the LookUp
LookUpValue = "Ground type"
LookUpTable = "Ground_type_table[#Alle]"
ValueReturned = Application.WorksheetFunction.VLookup(LookUpValue, LookUpTable, 4, False)
ws.Range("C1").Formula = "=1+" & Val(ValueReturned)
End Select
End If
End Sub