Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Macro - Format Spreadsheet

One way to do #1:

Option Explicit
Sub testme01()

Dim rngSearch As Range
Dim rngFound As Range

With Worksheets("sheet1")
Set rngSearch = .Cells 'or .range("a:a") or .range("a:e")
With rngSearch
Do
Set rngFound = .Find("premium", LookIn:=xlValues, _
lookat:=xlWhole, searchdirection:=xlNext, _
MatchCase:=False)

If rngFound Is Nothing Then
Exit Do
Else
rngFound.EntireRow.Delete
End If
Loop
End With
End With

End Sub

And for #2. It's probably easiest to just record a macro when you do it
manually.

Select your range, then Data|sort

After the sort, select the range, then Data|Subtotals

It won't insert two blank rows, but using excel's builtin functions may make
your life a lot easier.



ACase wrote:

Hello,

I want to format a spreadsheet and need to do 2 things via a macro.

1) Search for a particular string "Premium" and delete all rows with this
value

2) Sort on 3 fields (Underlying, Trade Type, and BuySell) add two blank
lines whenver there is a change in the above three, and subtotal on Position.

Any help would be much appreciated.

Thanks
ACase


--

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
Macro to copy and append spreadsheet changes to new spreadsheet Journey Excel Discussion (Misc queries) 1 June 13th 08 04:33 PM
Format Spreadsheet DBM Excel Discussion (Misc queries) 2 January 3rd 07 09:11 AM
Excel Form Format to Spreadsheet Format Karen Excel Discussion (Misc queries) 4 October 23rd 06 06:03 PM
Is there a way to insert a formula, password or macro in an excel spreadsheet that will automatically delete the spreadsheet? oil_driller Excel Discussion (Misc queries) 1 February 8th 05 09:34 AM
Macro to save excel XP spreadsheet to excel 97 spreadsheet format Mas[_5_] Excel Programming 1 February 11th 04 08:44 PM


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