Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
if cell contains this AND that - like operator?
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Change operator from cell value | Excel Worksheet Functions | |||
Reference an Operator from a cell with Sumproduct | Excel Worksheet Functions | |||
Can I absolute cell an operator: and/or | Excel Discussion (Misc queries) | |||
How to use a cell value as operator in a worksheet reference? | Excel Worksheet Functions | |||
add one cell with no equals operator | Excel Discussion (Misc queries) |