Need a Little Macro Code ...

K

Ken

Excel 2000 ... Each month I create 7 identical spread
sheets (Approx 30 Columns x 15,000 Rows with Borders) from
a Master Template ... Then I paste data into each from an
Access application (pasted data is always <15,000
rows) ... After pasting I run a recorded Macro to format
all data ... This all works fine ...

Issue ... after running Macro I then delete all unused
rows appearing below my data in order to get rid of all
unused Borders ... I would like a little Macro instruction
to accomplish this that I can insert into my recorded
Macro?

My Thanks to all the Excel Wizards that continually
support this board ... Kha
 
B

Bob Phillips

Something like

cLastRow = Cells(Rows.Count,"A").End(xlUp).Row
Set myRng = Range("A" & cLastRow+1 & ":A2500")
myRng.Entirerow.Delete

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
K

Ken

Bob ... Macro instruction not working? ... Macro is
deleting 2500 rows containing data ... Since my Col "A"
presently contains no data ... I revised Macro below by
changing "A" to "B" & A2500 to B2500 ... Macro produced
same results ... Deleted 2500 rows containing data??? ...
I need to delete all BLANK rows below my data (up to
15,000 rows) ... Thanks ... Kha
 
B

Bob Phillips

Ken,

Sorry, I read 15,000 as 1,500. Try this instead

cLastRow = Cells(Rows.Count,"B").End(xlUp).Row
Set myRng = Range("B" & cLastRow+1 & ":B25000")
myRng.Entirerow.Delete


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
K

Ken

Thanks Bob ... A BIG Help ... Kha
-----Original Message-----
Ken,

Sorry, I read 15,000 as 1,500. Try this instead

cLastRow = Cells(Rows.Count,"B").End(xlUp).Row
Set myRng = Range("B" & cLastRow+1 & ":B25000")
myRng.Entirerow.Delete


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)




.
 
Top