darthslayer
New Member
- Joined
- Apr 10, 2015
- Messages
- 1
I'm trying to create an self updating drop down list. To achive this I found a code and adapted it to my workbook. Code works if it's in the sheet named "default" but when I try to redirect it to another sheet, it stucks in the code below, with this error (method 'intersect' object' _global failed"
Code:
If Intersect(Target, Worksheets("default").Range("c" & count_cells + 1)) Is Nothing Then
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Dim count_cells As Integer
Dim new_value As String
Dim old_value As String
For count_cells = 1 To Worksheets("default").Range("c2:c400").CurrentRegion.Rows.Count - 1
If Intersect(Target, Worksheets("default").Range("c" & count_cells + 1)) Is Nothing Then
Else
Application.EnableEvents = False
new_value = Target.Value
Application.Undo
old_value = Target.Value
Target.Value = new_value
Range("AS:AS").Select
Selection.Replace What:=old_value, Replacement:=new_value, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Target.Select
End If
Next count_cells
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Last edited by a moderator: