Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
This sub looks for the words Trial Balance in column A. It will delete all
rows above the found row: Sub zero() Set r = ActiveSheet.UsedRange nLastRow = r.Rows.Count + r.Row - 1 killer = 0 For i = nLastRow To 1 Step -1 If killer = 1 Then Cells(i, 1).EntireRow.Delete End If If Cells(i, 1).Value = "Trial Balance" Then killer = 1 End If Next End Sub -- Gary''s Student - gsnu200742 "Darrilyn" wrote: I am trying to write a macro that will delete rows from a spreadsheet based on a condition. I pull information from another program into excel for budget purposes and it throws the company names in the header in column form, so based on how many companies I pull in the number of rows that will need to be deleted will be changing. I have text that starts after the companies names (Trial Balance) and I want this to always start on A7. My question is how do I tell excel to look for the word Trial Balance in Column A and then delete everything that comes before it? Any help is greatly appreciated. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
count filtered rows based on condition greater than forty | Excel Worksheet Functions | |||
How to delete a data row based on a condition | New Users to Excel | |||
Is there a way to delete a cell value based on a condition? | Excel Discussion (Misc queries) | |||
format group of rows based on condition | Excel Discussion (Misc queries) | |||
how do I delete all rows that match a condition? | Excel Worksheet Functions |