![]() |
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 |
LIKE in Excel VBA?
Well I was sure I had tried the wildcard *, but I went back and trie again and it worked, oops. :rolleyes: 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 |
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 |
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 |
All times are GMT +1. The time now is 12:07 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com