+ Reply to Thread
Results 1 to 3 of 3

Test for blank lines

  1. #1
    MarkN
    Guest

    Test for blank lines

    Hello,

    I have a macro that reformats a raw data dump for a third party application.
    The user creating the data dump chooses what information to include in the
    dump and this is causing me some problems.

    I need some code that will look for the column header called "Claim No" ,
    and then delete any rows above the row containing the "Claim No" label.

    Any help will be gratefully appreciated.
    --
    Thanks,
    MarkN

  2. #2
    Dave Peterson
    Guest

    Re: Test for blank lines

    Most of my column headers are in row 1.

    but maybe...

    Option Explicit
    Sub testme01()

    Dim RngToSearch As Range
    Dim LookForWhat As String
    Dim FoundCell As Range

    LookForWhat = "Claim No"

    With Worksheets("sheet1")
    Set RngToSearch = .Range("a:a") 'I used column A.
    With RngToSearch
    Set FoundCell = .Cells.Find(what:=LookForWhat, _
    after:=.Cells(.Cells.Count), _
    LookIn:=xlValues, _
    lookat:=xlWhole, _
    searchorder:=xlByRows, _
    searchdirection:=xlNext, _
    MatchCase:=False)
    End With

    If FoundCell Is Nothing Then
    MsgBox "Not Found"
    Else
    If FoundCell.Row = 1 Then
    MsgBox "Found in row 1--not deleted!"
    Else
    .Range("A1:A" & FoundCell.Row - 1).EntireRow.Delete
    End If
    End If
    End With

    End Sub

    MarkN wrote:
    >
    > Hello,
    >
    > I have a macro that reformats a raw data dump for a third party application.
    > The user creating the data dump chooses what information to include in the
    > dump and this is causing me some problems.
    >
    > I need some code that will look for the column header called "Claim No" ,
    > and then delete any rows above the row containing the "Claim No" label.
    >
    > Any help will be gratefully appreciated.
    > --
    > Thanks,
    > MarkN


    --

    Dave Peterson

  3. #3
    MarkN
    Guest

    Re: Test for blank lines

    Hello Dave,

    You're a genius, thanks very much.
    --
    Thanks,
    MarkN


    "Dave Peterson" wrote:

    > Most of my column headers are in row 1.
    >
    > but maybe...
    >
    > Option Explicit
    > Sub testme01()
    >
    > Dim RngToSearch As Range
    > Dim LookForWhat As String
    > Dim FoundCell As Range
    >
    > LookForWhat = "Claim No"
    >
    > With Worksheets("sheet1")
    > Set RngToSearch = .Range("a:a") 'I used column A.
    > With RngToSearch
    > Set FoundCell = .Cells.Find(what:=LookForWhat, _
    > after:=.Cells(.Cells.Count), _
    > LookIn:=xlValues, _
    > lookat:=xlWhole, _
    > searchorder:=xlByRows, _
    > searchdirection:=xlNext, _
    > MatchCase:=False)
    > End With
    >
    > If FoundCell Is Nothing Then
    > MsgBox "Not Found"
    > Else
    > If FoundCell.Row = 1 Then
    > MsgBox "Found in row 1--not deleted!"
    > Else
    > .Range("A1:A" & FoundCell.Row - 1).EntireRow.Delete
    > End If
    > End If
    > End With
    >
    > End Sub
    >
    > MarkN wrote:
    > >
    > > Hello,
    > >
    > > I have a macro that reformats a raw data dump for a third party application.
    > > The user creating the data dump chooses what information to include in the
    > > dump and this is causing me some problems.
    > >
    > > I need some code that will look for the column header called "Claim No" ,
    > > and then delete any rows above the row containing the "Claim No" label.
    > >
    > > Any help will be gratefully appreciated.
    > > --
    > > Thanks,
    > > MarkN

    >
    > --
    >
    > Dave Peterson
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1