How Can I Do This

D

Daniel Weston

At work I had a spreadhseet which was basically a list of reconciliations
from cash machines.

The layout consisted of a code followed by some amounts e.g

CH455454 10/5/05£1342 £1000 £2342

I get reports in everyday and used to add them to the spreadhseet one after
the other with gaps in between each code

eg CH12345 10/05/01 £1000 £1234 £2234
CH12345 17/05/01 £1000 £1234 £2234

CH98765 10/05/01 £2000 £2000 £4000


When a new report comes in I now copy and paste the new insformation at the
bottom of the spreadhsheet and use date sort to put the entry in the correct
place.

When doing this manually it was easy to insert a blank line after the entry,
but how would do I add a blank line automatically after the last entry, just
to divide up the list of very similar looking figures,

Any help appreciated,

Daniel
 
S

Sandy Mann

Daniel,

Assuming that your data starts in A4 with titles & headings above that then
try:

Sub InsertIt()
Dim LastCell As Long
Dim x As Long

Application.ScreenUpdating = False

LastCell = Cells(Rows.Count, 1).End(xlUp).Row

For x = LastCell To 5 Step -1
If Cells(x, 1).Value <> _
Cells(x - 1, 1).Value Then _
Rows(x).EntireRow.Insert
Next x

Application.ScreenUpdating = True

End Sub

Always backup your data before trying anything new.

HTH

Sandy
 

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