Solved

Find a word then delete all rows above it

Posted on 2014-11-18
2
65 Views
Last Modified: 2014-11-19
I have searched EE but cannot find the specific code I am looking for.

Could an expert please provide me with code that will find the word Counterparty Code the delete all rows above it keeping the row with Counterparty Code

Many thanks
0
Comment
Question by:Jagwarman
2 Comments
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40449513
Hi,

pls try

Sub Macro1()
'
' Macro1 Macro
'

'
    CountrpartyRow = Cells.Find(What:="Counterparty Code", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
        xlNext, MatchCase:=False, SearchFormat:=False).Row
    If CountrpartyRow > 1 Then
        Rows("1:" & CountrpartyRow - 1).Delete
    End If
End Sub

Open in new window

Regards
0
 

Author Closing Comment

by:Jagwarman
ID: 40451865
superstar, thanks
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now