VB script and disappearing information

A

Abi

I'm using the following script to make it easier on users when they enter
data. Instead of them having to tpye "One-Man" or "Two-Man" they type 1 or 2
and it the coinciding phrase appears instead.

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Range("B208") = 1 Then
Range("B208") = "One-Man"
ElseIf Range("B208") = 2 Then
Range("B208") = "Two-Man"
Else
Range("B208") = ""
End If
Application.EnableEvents = True
End Sub

The users are entering data in the B column of one sheet and that info
filters through to other sheets. The one-man two-man info is entered into
B208. Directly below that are other cells that need to have information
entered into them. However, when I enter the information in cell B209, or
B210, etc., it deletes the information out of cell B208.

Can anyone tell me what's going on, and how I can fix it? Thanks!
 
T

Tom Ogilvy

Private Sub Worksheet_Change(ByVal Target As Range)
if Target.count > 1 then exit sub
if Target.Address = "$B$208" then
Application.EnableEvents = False
If Range("B208") = 1 Then
Range("B208") = "One-Man"
ElseIf Range("B208") = 2 Then
Range("B208") = "Two-Man"
Else
Range("B208") = ""
End If
Application.EnableEvents = True
End If
End Sub
 
A

Abi

Thank you!

Tom Ogilvy said:
Private Sub Worksheet_Change(ByVal Target As Range)
if Target.count > 1 then exit sub
if Target.Address = "$B$208" then
Application.EnableEvents = False
If Range("B208") = 1 Then
Range("B208") = "One-Man"
ElseIf Range("B208") = 2 Then
Range("B208") = "Two-Man"
Else
Range("B208") = ""
End If
Application.EnableEvents = True
End If
End Sub
 

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