how do I create a formula

H

Harold

can anybody help me???

I'm trying to creat a formula In excel for a spread sheet that i'm creating.
ok here we go what I'm trying to do is that if I input the number 1 in a cell
i want the next cell to automatically inputs of what number 1 repersents .
Example In C5 I enter the number 1, in C6 autmaically inputs Tree so the
formual should represents if 1=tree. Thats were im getting stuck I do not
know how to create this formula.
 
B

Bob Phillips

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "5:5" '<== change to suit
Dim sh As Worksheet

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target

Select Case .Value

Case 1: .Offset(1, 0).Value = "tree"
Case 2: .Offset(1, 0).Value = "hedge"
'etc
End Select
End With
End If

End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top