LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change operator from cell value Gareth.Evans Excel Worksheet Functions 5 February 24th 09 02:30 PM
Reference an Operator from a cell with Sumproduct deeds Excel Worksheet Functions 4 April 25th 08 04:06 PM
Can I absolute cell an operator: and/or nastech Excel Discussion (Misc queries) 1 June 10th 07 10:19 PM
How to use a cell value as operator in a worksheet reference? JRP2003 Excel Worksheet Functions 2 August 14th 06 06:24 PM
add one cell with no equals operator reggie26t Excel Discussion (Misc queries) 1 January 24th 06 02:57 PM


All times are GMT +1. The time now is 11:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"