Thread: Need 2 macros
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
chrisnsmith chrisnsmith is offline
external usenet poster
 
Posts: 96
Default Need 2 macros

CurlyDave,
I need you to refine your code. At present when I run the macro it
deletes everything above row six. I need to keep these rows because they
contain text info.
I'm attaching an example of my worksheet.

A B C D E
1 Company Name Date
2 Other Info
3 "
4 "
5 ACCT COMM STRIKE LONG SHORT
6 Data begins here.
7
8
9
10
11
12
13
14
15

"CurlyDave" wrote:

On Mar 1, 7:59 am, CurlyDave wrote:
Try this,

Sub FindValueDeleteRow()
Dim s As String, Count As Integer
Application.ScreenUpdating = False
s = "R"
For Count = 1 To ActiveSheet.UsedRange.Rows.Count

Set f = Cells.Find(s, LookIn:=xlValues)
If Not f Is Nothing Then
f.EntireRow.Delete 'Shift:=xlUp
Application.ScreenUpdating = True
End If
Next Count
End Sub
Sub ClearRange()
Dim r As Range
Set r = Range(Range("A3"), Range("A3").SpecialCells(xlLastCell))
r.ClearContents
End Sub


Change

f.EntireRow.Delete 'Shift:=xlUp

f=""
To just clear the contents