[mso] XL VB:Find first and last

  • From: "April Pace" <apace@xxxxxxxxxxxxxxxxxxxxx>
  • To: <ARPACE@xxxxxxxxxxxxx>, <mso@xxxxxxxxxxxxx>
  • Date: Mon, 29 Nov 2004 13:36:41 -0500

Range("A1:AZ60000").Activate
    Selection.Sort Key1:=Range("A2"), Order1:=xlAscending,
Header:=xlGuess, _

        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _

        DataOption1:=xlSortNormal

Cells.Find(What:="Database", After:=ActiveCell, LookIn:=xlFormulas, _

        LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
_

        MatchCase:=False, SearchFormat:=False).Activate

    ActiveCell.Select

    Range(Selection, Selection.Offset(0, 200)).Select

    Range(Selection, Selection.Offset(1000, 0)).Select

    Selection.Delete

 

 

Database:

BC_PROD

 

Check Register

 

 

 

Page:      2

Database:

BC_PROD

 

Check Register

 

 

 

Page:      3

Database:

BC_PROD

 

Check Register

 

 

 

Page:      4

Database:

BC_PROD

 

Check Register

 

 

 

Page:      5

Database:

BC_PROD

 

Check Register

 

 

 

Page:      6

Entity

Check # Check Date

Vendor Invoice Number

 

Amount Number

Approval

 

Entity

Check # Check Date

Vendor Invoice Number

 

Amount Number

Approval

 

Entity

Check # Check Date

Vendor Invoice Number

 

Amount Number

Approval

 

Entity

Check # Check Date

Vendor Invoice Number

 

Amount Number

Approval

 

Entity

Check # Check Date

Vendor Invoice Number

 

Amount Number

Approval

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I need help figuring out how to write some VB.  The code above is what I
have now, but I need to make it more specific.  Right now the code says
find the 1st time you see the word "Database", make it the active cell,
and delete that row and every row below it.  I am finding out that I may
have rows below the word "Database" the I will need to keep, so I need
to figure out how to get the code to find the first row with the word
"Database" and the last row with the word "Entity" and just delete those
rows.  Any idea's?  I'm sure this is probably a "Loop until" but I don't
know how to write it.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: