ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   deleting rows (https://www.excelbanter.com/excel-discussion-misc-queries/167437-deleting-rows.html)

mohavv

deleting rows
 
Hi,

After opening a txt file all the page header appear after every 31
rows.
All exactly the same.

I want to create a macro to create a workable sheet, using text to
column. I know how to do this, but ...

first I want to get rid of all the unnecessary rows ("headers" and
"footers"). Using relative cell reference to delete these rows didn't
work, because I have to know how often it has to do this. The files
vary in length, so this is not possible.

Is it possible to have excel find all the values in cell A3 and delete
the rows which are the same or contain the same text.

If I know how to do this, I'll probably can find out how to go on.

Cheers,

Harold

carlo

deleting rows
 
You can do this:

for i = 4 to cells(65536,1).end(xlup).row
if cells(i,1).value = cells(3,1).value then
rows(i).delete (xlup)
i = i - 1
end if
next i

hth

Carlo

On Nov 27, 12:37 pm, mohavv wrote:
Hi,

After opening a txt file all the page header appear after every 31
rows.
All exactly the same.

I want to create a macro to create a workable sheet, using text to
column. I know how to do this, but ...

first I want to get rid of all the unnecessary rows ("headers" and
"footers"). Using relative cell reference to delete these rows didn't
work, because I have to know how often it has to do this. The files
vary in length, so this is not possible.

Is it possible to have excel find all the values in cell A3 and delete
the rows which are the same or contain the same text.

If I know how to do this, I'll probably can find out how to go on.

Cheers,

Harold




All times are GMT +1. The time now is 03:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com