Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default MACRO which deletes a row, when it finds a specific number

Hi,

I want to create a macro which find one specific number in the column B and
delete the row.
For example: There is the number 60 in the cell B15 by accident. The macro
will delete the row No 15.

Thanks in advance,
Spiros


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default MACRO which deletes a row, when it finds a specific number

You could apply autofilter to column B, select 60 from the drop-down,
highlight the visible rows and Edit | Delete Row. Then select All from
the drop-down.

Hope this helps.

Pete

On Dec 3, 7:51 am, Spiros wrote:
Hi,

I want to create a macro which find one specific number in the column B and
delete the row.
For example: There is the number 60 in the cell B15 by accident. The macro
will delete the row No 15.

Thanks in advance,
Spiros


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default MACRO which deletes a row, when it finds a specific number

Record a macro using editfind. If you want more than one use findnext

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Spiros" wrote in message
...
Hi,

I want to create a macro which find one specific number in the column B
and
delete the row.
For example: There is the number 60 in the cell B15 by accident. The macro
will delete the row No 15.

Thanks in advance,
Spiros



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default MACRO which deletes a row, when it finds a specific number

Guys thank you for your suggestions.
I find this macro end it works.

Sub testme02()

Dim myRng As Range
Dim FoundCell As Range
Dim wks As Worksheet
Dim myStrings As Variant
Dim iCtr As Long

myStrings = Array("60") 'add more strings if you need

Set wks = ActiveSheet

With wks
Set myRng = .Range("b2:b" & .Rows.Count)
End With

For iCtr = LBound(myStrings) To UBound(myStrings)
Do
With myRng
Set FoundCell = .Cells.Find(what:=myStrings(iCtr), _
after:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
lookat:=xlWhole, _
searchorder:=xlByRows, _
searchdirection:=xlNext, _
MatchCase:=False)

If FoundCell Is Nothing Then
Exit Do
Else
FoundCell.EntireRow.Delete
End If
End With
Loop
Next iCtr
End Sub

Ο χρήστης "Don Guillett" *γγραψε:

Record a macro using editfind. If you want more than one use findnext

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Spiros" wrote in message
...
Hi,

I want to create a macro which find one specific number in the column B
and
delete the row.
For example: There is the number 60 in the cell B15 by accident. The macro
will delete the row No 15.

Thanks in advance,
Spiros




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
Create a macro that finds values then sorts John Hughes Excel Worksheet Functions 2 August 30th 06 12:10 AM
Macro that deletes every third row....+ ajjag Excel Discussion (Misc queries) 4 June 27th 06 06:03 PM
What is a function in VBA EXCEL witch finds a string like "not" in cell and then deletes a row with this cell? [email protected] Excel Worksheet Functions 3 November 14th 05 01:48 AM
macro that finds text and keeps only part of it john mcmichael Excel Discussion (Misc queries) 5 October 18th 05 10:58 PM
Which @function finds the mean of a number? Coffeecoco930 Excel Worksheet Functions 5 December 9th 04 03:11 AM


All times are GMT +1. The time now is 06:46 AM.

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"