already
Board Regular
- Joined
- Nov 11, 2008
- Messages
- 179
Hi
I have downloaded a piece of code a time ago to fill a cell with a part
of the dropdown list. (ex dropdown is '1000 - appel' cell is filled only with '1000' this is working very well. Now I want to use this again in another workbook and it didn't work. Hi have compared the code and I can't find the difference. Strange also is that the 2 codes are working well on my pc at home but that only the 'old' code is working at my office. Is this due to an excel setting in the workbook or ...?
excel version 2010
code
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo errHandler
If Target.Cells.Count > 1 Then GoTo exitHandler
If Target.Column = 2 Then
If Target.Value = "" Then GoTo exitHandler
Application.EnableEvents = False
Target.Value = Worksheets("Codes").Range("C1") _
.Offset(Application.WorksheetFunction _
.Match(Target.Value, Worksheets("Codes").Range("ProdList"), 0), 0)
End If
exitHandler:
Application.EnableEvents = True
Exit Sub
errHandler:
If Err.Number = 13 Or Err.Number = 1004 Then
GoTo exitHandler
Else
Resume Next
End If
End Sub
Sub MyFix()
Application.EnableEvents = True
End Sub
Any help is welcome
Kind reagards
Al
I have downloaded a piece of code a time ago to fill a cell with a part
of the dropdown list. (ex dropdown is '1000 - appel' cell is filled only with '1000' this is working very well. Now I want to use this again in another workbook and it didn't work. Hi have compared the code and I can't find the difference. Strange also is that the 2 codes are working well on my pc at home but that only the 'old' code is working at my office. Is this due to an excel setting in the workbook or ...?
excel version 2010
code
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo errHandler
If Target.Cells.Count > 1 Then GoTo exitHandler
If Target.Column = 2 Then
If Target.Value = "" Then GoTo exitHandler
Application.EnableEvents = False
Target.Value = Worksheets("Codes").Range("C1") _
.Offset(Application.WorksheetFunction _
.Match(Target.Value, Worksheets("Codes").Range("ProdList"), 0), 0)
End If
exitHandler:
Application.EnableEvents = True
Exit Sub
errHandler:
If Err.Number = 13 Or Err.Number = 1004 Then
GoTo exitHandler
Else
Resume Next
End If
End Sub
Sub MyFix()
Application.EnableEvents = True
End Sub
Any help is welcome
Kind reagards
Al