Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default LIKE in Excel VBA?


Hi, this seems like a pretty basic function so you will have to forgive
my ignorance. I want to delete all rows where a cell begins with a set
string. I have searched all over Google, but this is one of those
searches where I cannot quite seem to find the right words.

This is my conditional statement:
...
If ActiveCell.Value Like " Call%" Then
Selection.EntireRow.Delete
...

Cheers,

Anders.


--
Anders001
------------------------------------------------------------------------
Anders001's Profile: http://www.excelforum.com/member.php...o&userid=28030
View this thread: http://www.excelforum.com/showthread...hreadid=475335

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default LIKE in Excel VBA?


Well I was sure I had tried the wildcard *, but I went back and trie
again and it worked, oops. Clearly I have been doing to
much SQL recently

--
Anders00
-----------------------------------------------------------------------
Anders001's Profile: http://www.excelforum.com/member.php...fo&userid=2803
View this thread: http://www.excelforum.com/showthread.php?threadid=47533

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default LIKE in Excel VBA?

Hi

VB wildcard is * , not % as you seem to know it from SQL.

Sub test()
MsgBox " Caller" Like " Call%"
MsgBox " Caller" Like " Call*"
MsgBox "Caller" Like " Call*"
End Sub

HTH. best wishes Harald

"Anders001" skrev i
melding ...

Hi, this seems like a pretty basic function so you will have to forgive
my ignorance. I want to delete all rows where a cell begins with a set
string. I have searched all over Google, but this is one of those
searches where I cannot quite seem to find the right words.

This is my conditional statement:
..
If ActiveCell.Value Like " Call%" Then
Selection.EntireRow.Delete
..

Cheers,

Anders.


--
Anders001
------------------------------------------------------------------------
Anders001's Profile:

http://www.excelforum.com/member.php...o&userid=28030
View this thread: http://www.excelforum.com/showthread...hreadid=475335



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default LIKE in Excel VBA?

If you mean to find all cells beginning with " Call%" (four spaces +
Call%) then apply

If ActiveCell.Value Like " Call%*" Then

Stefi


"Anders001" wrote:


Hi, this seems like a pretty basic function so you will have to forgive
my ignorance. I want to delete all rows where a cell begins with a set
string. I have searched all over Google, but this is one of those
searches where I cannot quite seem to find the right words.

This is my conditional statement:
...
If ActiveCell.Value Like " Call%" Then
Selection.EntireRow.Delete
...

Cheers,

Anders.


--
Anders001
------------------------------------------------------------------------
Anders001's Profile: http://www.excelforum.com/member.php...o&userid=28030
View this thread: http://www.excelforum.com/showthread...hreadid=475335


Reply
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



All times are GMT +1. The time now is 05:21 PM.

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

About Us

"It's about Microsoft Excel"