Automatically Delete Text at the end of an imported report into Ex

G

Guest

I have a report that I import into Excel each day. At the bottom of the
report is text I want to delete before running a macro. The number of rows
in the report varies each day. I'd like to add code in my macro that
automatically deletes that specific text at the end of the report or deletes
the last 3 rows no matter how many rows are in the report. Can this be done
with VBA code? Thank you
 
T

Tom Ogilvy

Assume the text is in column A (adjust to the actual situation)

Dim rng as Range
set rng = Cells(rows.count,"A").End(xlup).Offset(-2,0).Resize(3)
rng.entireRow.Delete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top