Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Logical Test for blank and then for score | Excel Worksheet Functions | |||
A logical test in the If function for blank, i.e., If blank? | Excel Worksheet Functions | |||
Macro not recognizing blank lines as blank | Excel Discussion (Misc queries) | |||
Help Please: Need code to test several lines | Excel Programming | |||
how to automatically insert blank lines in between non-blank lines | Excel Programming |