#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default wild card *

My macro below is not working properly:

Sub Deletedepo()


With ActiveSheet
..DisplayPageBreaks = False
StartRow = 1
EndRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1

If .Cells(Lrow, "C").Value = "CASH DEPOSIT *" Then

..Rows(Lrow).Delete
End If
Next
End With
End Sub

I would like to delete all rows with cells in column c containing e.g
Cash deposit GBP1000
Cash deposit Euro 50
But the wild card * is not working - can someone pls correct my macro
Thxs


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default wild card *

Try this:

Sub Deletedepo()

With ActiveSheet
..DisplayPageBreaks = False
StartRow = 1
EndRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1

strVal=.Cells(Lrow, "C").Value
If LEFT(strVal,12) = "CASH DEPOSIT" Then

..Rows(Lrow).Delete
End If
Next
End With
End Sub


On Nov 9, 11:18 am, transferxxx wrote:
My macro below is not working properly:

Sub Deletedepo()

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 1
EndRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1

If .Cells(Lrow, "C").Value = "CASH DEPOSIT *" Then

.Rows(Lrow).Delete
End If
Next
End With
End Sub

I would like to delete all rows with cells in column c containing e.g
Cash deposit GBP1000
Cash deposit Euro 50
But the wild card * is not working - can someone pls correct my macro
Thxs



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default wild card *

thxs it works - but i don't understand why * can't make it - can someone
explain it to me thxs

"Faisal..." wrote:

Try this:

Sub Deletedepo()

With ActiveSheet
..DisplayPageBreaks = False
StartRow = 1
EndRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1

strVal=.Cells(Lrow, "C").Value
If LEFT(strVal,12) = "CASH DEPOSIT" Then

..Rows(Lrow).Delete
End If
Next
End With
End Sub


On Nov 9, 11:18 am, transferxxx wrote:
My macro below is not working properly:

Sub Deletedepo()

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 1
EndRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1

If .Cells(Lrow, "C").Value = "CASH DEPOSIT *" Then

.Rows(Lrow).Delete
End If
Next
End With
End Sub

I would like to delete all rows with cells in column c containing e.g
Cash deposit GBP1000
Cash deposit Euro 50
But the wild card * is not working - can someone pls correct my macro
Thxs




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default wild card *

This is looking for an asterisk--not a wildcard:
If .Cells(Lrow, "C").Value = "CASH DEPOSIT *" Then
That's the way "=" works.

You may want to look at VBA's help for Like (where you can use wildcards).

transferxxx wrote:

thxs it works - but i don't understand why * can't make it - can someone
explain it to me thxs

"Faisal..." wrote:

Try this:

Sub Deletedepo()

With ActiveSheet
..DisplayPageBreaks = False
StartRow = 1
EndRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1

strVal=.Cells(Lrow, "C").Value
If LEFT(strVal,12) = "CASH DEPOSIT" Then

..Rows(Lrow).Delete
End If
Next
End With
End Sub


On Nov 9, 11:18 am, transferxxx wrote:
My macro below is not working properly:

Sub Deletedepo()

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 1
EndRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1

If .Cells(Lrow, "C").Value = "CASH DEPOSIT *" Then

.Rows(Lrow).Delete
End If
Next
End With
End Sub

I would like to delete all rows with cells in column c containing e.g
Cash deposit GBP1000
Cash deposit Euro 50
But the wild card * is not working - can someone pls correct my macro
Thxs





--

Dave Peterson
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wild card quaestion Andrew Mackenzie Excel Discussion (Misc queries) 4 October 28th 09 01:26 PM
Using a wild card in SUMPRODUCT SFC Traver Excel Worksheet Functions 8 February 16th 09 06:11 PM
Wild Card? fpd833 Excel Programming 0 September 20th 07 07:26 PM
Wild Card!!!??? Sean Excel Programming 3 August 31st 06 06:55 PM
Wild card * Herman Excel Worksheet Functions 0 October 21st 05 01:39 PM


All times are GMT +1. The time now is 12:11 AM.

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"