Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Deleting text in a column

Im trying to create a function that will delete the entire row if a
cell contains the text ***SCRATCHED***.


Function REMOVESCRATCHINGS()

Init = Range("C1:C200")

For COUNTER = 1 To 200

If Init = "***SCRATCHED***" Then
Selection.Delete shift:=xlUp

End If

Next

End Function

I get a type mismatch error message

Thanks for any help.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Deleting text in a column

Hi,

It's no longer a function it's a sub so try this

Sub REMOVESCRATCHINGS()
For x = 200 To 1 Step -1
If Cells(x, 3).Value = "***SCRATCHED***" Then
Rows(x).EntireRow.Delete
End If
Next
End Sub

Mike

" wrote:

Im trying to create a function that will delete the entire row if a
cell contains the text ***SCRATCHED***.


Function REMOVESCRATCHINGS()

Init = Range("C1:C200")

For COUNTER = 1 To 200

If Init = "***SCRATCHED***" Then
Selection.Delete shift:=xlUp

End If

Next

End Function

I get a type mismatch error message

Thanks for any help.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Deleting text in a column

On Feb 22, 7:01*pm, Mike H wrote:
Hi,

It's no longer a function it's a sub so try this

Sub REMOVESCRATCHINGS()
For x = 200 To 1 Step -1
* * If Cells(x, 3).Value = "***SCRATCHED***" Then
* * * * Rows(x).EntireRow.Delete
* * End If
Next
End Sub

Mike



" wrote:
Im trying to create a function that will delete the entire row if a
cell contains the text ***SCRATCHED***.


Function REMOVESCRATCHINGS()


Init = Range("C1:C200")


For COUNTER = 1 To 200


If Init = "***SCRATCHED***" Then
* *Selection.Delete shift:=xlUp


End If


Next


End Function


I get a type mismatch error message


Thanks *for any help.- Hide quoted text -


- Show quoted text -


Mike ..I'll have to play around with your sub - nothing happens when I
run it.. at least there's no error messages. Thanks
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Deleting text in a column

On Feb 22, 8:20*pm, wrote:
On Feb 22, 7:01*pm, Mike H wrote:





Hi,


It's no longer a function it's a sub so try this


Sub REMOVESCRATCHINGS()
For x = 200 To 1 Step -1
* * If Cells(x, 3).Value = "***SCRATCHED***" Then
* * * * Rows(x).EntireRow.Delete
* * End If
Next
End Sub


Mike


" wrote:
Im trying to create a function that will delete the entire row if a
cell contains the text ***SCRATCHED***.


Function REMOVESCRATCHINGS()


Init = Range("C1:C200")


For COUNTER = 1 To 200


If Init = "***SCRATCHED***" Then
* *Selection.Delete shift:=xlUp


End If


Next


End Function


I get a type mismatch error message


Thanks *for any help.- Hide quoted text -


- Show quoted text -


Mike ..I'll have to play around with your sub - nothing happens when I
run it.. at least there's no error messages. Thanks- Hide quoted text -

- Show quoted text -


Mike...The sub works fine for numbers but I cant make it work for
text
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Deleting text in a column

Hi Mike,

2 versions. The top one works for text and the second for numbers. Note that
the asterix in the first aren't wildcards, if thats what you want post back.
As written it will delet rows where C contains ***SCRATCHED*** and it's case
sensitive so it wont delete "***SCRATCHeD***"



Sub REMOVESCRATCHINGS()
For x = 200 To 1 Step -1
If Cells(x, 3).Value = "***SCRATCHED***" Then
Rows(x).EntireRow.Delete
End If
Next
End Sub

Sub REMOVESCRATCHINGS1()
For x = 200 To 1 Step -1
If Cells(x, 3).Value = 99 Then
Rows(x).EntireRow.Delete
End If
Next
End Sub


Mike
" wrote:

On Feb 22, 8:20 pm, wrote:
On Feb 22, 7:01 pm, Mike H wrote:





Hi,


It's no longer a function it's a sub so try this


Sub REMOVESCRATCHINGS()
For x = 200 To 1 Step -1
If Cells(x, 3).Value = "***SCRATCHED***" Then
Rows(x).EntireRow.Delete
End If
Next
End Sub


Mike


" wrote:
Im trying to create a function that will delete the entire row if a
cell contains the text ***SCRATCHED***.


Function REMOVESCRATCHINGS()


Init = Range("C1:C200")


For COUNTER = 1 To 200


If Init = "***SCRATCHED***" Then
Selection.Delete shift:=xlUp


End If


Next


End Function


I get a type mismatch error message


Thanks for any help.- Hide quoted text -


- Show quoted text -


Mike ..I'll have to play around with your sub - nothing happens when I
run it.. at least there's no error messages. Thanks- Hide quoted text -

- Show quoted text -


Mike...The sub works fine for numbers but I cant make it work for
text



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Deleting text in a column

Steve if you want wilcards for text and something that isn't case sensitive
use this

If UCase(Cells(x, 3).Value) Like "*SCRATCHED*" Then



Mike

" wrote:

On Feb 22, 8:20 pm, wrote:
On Feb 22, 7:01 pm, Mike H wrote:





Hi,


It's no longer a function it's a sub so try this


Sub REMOVESCRATCHINGS()
For x = 200 To 1 Step -1
If Cells(x, 3).Value = "***SCRATCHED***" Then
Rows(x).EntireRow.Delete
End If
Next
End Sub


Mike


" wrote:
Im trying to create a function that will delete the entire row if a
cell contains the text ***SCRATCHED***.


Function REMOVESCRATCHINGS()


Init = Range("C1:C200")


For COUNTER = 1 To 200


If Init = "***SCRATCHED***" Then
Selection.Delete shift:=xlUp


End If


Next


End Function


I get a type mismatch error message


Thanks for any help.- Hide quoted text -


- Show quoted text -


Mike ..I'll have to play around with your sub - nothing happens when I
run it.. at least there's no error messages. Thanks- Hide quoted text -

- Show quoted text -


Mike...The sub works fine for numbers but I cant make it work for
text

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Deleting text in a column

On Feb 22, 9:48*pm, Mike H wrote:
Steve if you want wilcards for text and something that isn't case sensitive
use this

If UCase(Cells(x, 3).Value) Like "*SCRATCHED*" Then

Mike


Mike H .. Works fine with this line replacing the original. I dont
understand why your original sub didnt work. Many thanks Mike M
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
Deleting every nth through every nth row in a column Chris Excel Discussion (Misc queries) 1 July 9th 06 09:23 AM
Deleting nth row or column tarunpathria Excel Discussion (Misc queries) 1 February 15th 06 10:36 AM
Deleting a column reena Excel Discussion (Misc queries) 4 February 15th 06 06:45 AM
Deleting content in a column JamesBL Excel Worksheet Functions 1 November 2nd 04 11:16 PM
Deleting content in a column JamesBL Excel Worksheet Functions 1 November 2nd 04 02:21 AM


All times are GMT +1. The time now is 02:56 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"