ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB script and disappearing information (https://www.excelbanter.com/excel-programming/320981-vbulletin-script-disappearing-information.html)

Abi

VB script and disappearing information
 
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!

Tom Ogilvy

VB script and disappearing information
 
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

--
Regards,
Tom Ogilvy

"Abi" wrote in message
...
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!




Abi

VB script and disappearing information
 
Thank you!

"Tom Ogilvy" wrote:

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

--
Regards,
Tom Ogilvy

"Abi" wrote in message
...
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!






All times are GMT +1. The time now is 03:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com