Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
find text and delete rows.
need a macro, anyone know how to find a text in the worksheet and delete
range rows from the text it fund. sample: text in column A row 12, I want to delete rows from rows 3-12 or text in rows 50, I want to delete from rows 50-58. pls help. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
find text and delete rows.
You would have to define your exact conditions, including what the TEXT is,
or where it may be found, and which rows relative to it's found location to be deleted. Then a macro can be written to satisfy your requirements. Vaya con Dios, Chuck, CABGx3 "John" wrote: need a macro, anyone know how to find a text in the worksheet and delete range rows from the text it fund. sample: text in column A row 12, I want to delete rows from rows 3-12 or text in rows 50, I want to delete from rows 50-58. pls help. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
find text and delete rows.
the text is HEADER in rows 12, so I want to del start from rows 12-rows 1.
and in rows 50 text is MONEY, I want to del rows from 50-58. if the text in every worksheet at the different rows can it use same macro. "CLR" wrote: You would have to define your exact conditions, including what the TEXT is, or where it may be found, and which rows relative to it's found location to be deleted. Then a macro can be written to satisfy your requirements. Vaya con Dios, Chuck, CABGx3 "John" wrote: need a macro, anyone know how to find a text in the worksheet and delete range rows from the text it fund. sample: text in column A row 12, I want to delete rows from rows 3-12 or text in rows 50, I want to delete from rows 50-58. pls help. |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
find text and delete rows.
Maybe this will help..........it will perform on every sheet in the workbook.
Just be sure to back up your data first and use only a copy for testing. Sub DeleteCertainRows() Dim sh As Worksheet For Each sh In Worksheets sh.Select If Range("a50").Value = "money" Then Rows("50:58").EntireRow.Delete Else End If If Range("a12").Value = "header" Then Rows("1:12").EntireRow.Delete Else End If Next sh End Sub Vaya con Dios, Chuck, CABGx3 "John" wrote: the text is HEADER in rows 12, so I want to del start from rows 12-rows 1. and in rows 50 text is MONEY, I want to del rows from 50-58. if the text in every worksheet at the different rows can it use same macro. "CLR" wrote: You would have to define your exact conditions, including what the TEXT is, or where it may be found, and which rows relative to it's found location to be deleted. Then a macro can be written to satisfy your requirements. Vaya con Dios, Chuck, CABGx3 "John" wrote: need a macro, anyone know how to find a text in the worksheet and delete range rows from the text it fund. sample: text in column A row 12, I want to delete rows from rows 3-12 or text in rows 50, I want to delete from rows 50-58. pls help. |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
find text and delete rows.
Hi, this only can help for this worksheet. like what I said in every
worksheet the "header" and "money" is in different rows. that I need is a macro to do (find "header" in the worksheet and del from that rows up to the first rows and find the "money" then del from that rows to the last rows. so I only need to keep the rows under"header" to the rows befor "money". is that clear. "CLR" wrote: Maybe this will help..........it will perform on every sheet in the workbook. Just be sure to back up your data first and use only a copy for testing. Sub DeleteCertainRows() Dim sh As Worksheet For Each sh In Worksheets sh.Select If Range("a50").Value = "money" Then Rows("50:58").EntireRow.Delete Else End If If Range("a12").Value = "header" Then Rows("1:12").EntireRow.Delete Else End If Next sh End Sub Vaya con Dios, Chuck, CABGx3 "John" wrote: the text is HEADER in rows 12, so I want to del start from rows 12-rows 1. and in rows 50 text is MONEY, I want to del rows from 50-58. if the text in every worksheet at the different rows can it use same macro. "CLR" wrote: You would have to define your exact conditions, including what the TEXT is, or where it may be found, and which rows relative to it's found location to be deleted. Then a macro can be written to satisfy your requirements. Vaya con Dios, Chuck, CABGx3 "John" wrote: need a macro, anyone know how to find a text in the worksheet and delete range rows from the text it fund. sample: text in column A row 12, I want to delete rows from rows 3-12 or text in rows 50, I want to delete from rows 50-58. pls help. |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
find text and delete rows.
Assuming you found "money" and/or "header", do you want to delete the
same amount of rows each time? If so, you could do create 2 ranges: one for HEADER and one for MONEY. then offset them and delete the rows accordingly. Maybe something like this? Dim rngMoney As Range Dim srchMoney As Range Set srchMoney = Cells.Find("money") If Not srchMoney Is Nothing Then Set rngMoney = Range(srchMoney, srchMoney.Offset(0, -9)) End If and do the same for "header"..... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find and delete all other rows | Excel Discussion (Misc queries) | |||
Find & delete rows with ID's from another sheet. | Excel Discussion (Misc queries) | |||
how do i find and delete all empty rows in an excel worksheet | Excel Worksheet Functions | |||
Macro to find and delete rows! | Excel Discussion (Misc queries) | |||
How do I find duplicate rows in a list in Excel, and not delete it | Excel Discussion (Misc queries) |