Data Clean-up

  • Thread starter Thread starter garret
  • Start date Start date
G

garret

I am doing a spredsheet with several different sets of data. These
sets of data are of varying lengths so I recorded a macro that imported
the data and formated it. Because the data is of varying lengths the
macro drags some formulas down to a certain row that will cover all of
the data. My problem is I would like to record a macro that will
delete all of the draged formulas that go past the end of the data set.
Just clean up the rows that don't have the data in them. Can any one
help me?
 
Can you first delete the formulas from the 2nd row to the bottom?
Then copy the formulas down the current range.

Set rngDataTop = cell that is the top of the data range.
Set rngFormulaTop = cell that is the top of the formula range you want to
copy down
Set rngData = Range(rngDataTop,rngDataTop.end(xldown))
Set rngFormulas = range(rngFormlaTop,rngFormulaTop.end(xldown))
nrows = rngData.rows.count

'clear the formulas
rngFormulas.offset(1,0).clear

'Copy the formulas to the length of data.
rngFormulaTop.copy rngFormulaTop.offset(1,0).resize(nrows-1)

-Stephen Rasey
Houston
 

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

Back
Top