M
MiataDiablo
I've received wonderful help in getting this far in my macro; but how
do I modify the following to make allowance for this AND that? If my
cell isn't empty, I want "Subfile" entered in the next cell; however
if the cell also contains a comma and/or an ampersand, I want the word
"Subfiles" to be entered (i.e."CLN1237, BNK1535 & GEA1981" or "CLN1237
& BNK1535"). Do I insert the "like" operator as I would in an Access
query? If so, how? I tried "*,*" without luck.
Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set r = Range("N:N")
If Intersect(t, r) Is Nothing Then Exit Sub
Application.EnableEvents = False
v = t.Value
If v = "" Then
t.Offset(0, 1).Value = ""
Else
If v = "," Or v = "&" Then
t.Offset(0, 1).Value = "Subfiles"
Else
t.Offset(0, 1).Value = "Subfile"
End If
End If
Application.EnableEvents = True
End Sub
do I modify the following to make allowance for this AND that? If my
cell isn't empty, I want "Subfile" entered in the next cell; however
if the cell also contains a comma and/or an ampersand, I want the word
"Subfiles" to be entered (i.e."CLN1237, BNK1535 & GEA1981" or "CLN1237
& BNK1535"). Do I insert the "like" operator as I would in an Access
query? If so, how? I tried "*,*" without luck.
Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set r = Range("N:N")
If Intersect(t, r) Is Nothing Then Exit Sub
Application.EnableEvents = False
v = t.Value
If v = "" Then
t.Offset(0, 1).Value = ""
Else
If v = "," Or v = "&" Then
t.Offset(0, 1).Value = "Subfiles"
Else
t.Offset(0, 1).Value = "Subfile"
End If
End If
Application.EnableEvents = True
End Sub