Excel Macro help

J

Josh

I've exported data from one accounting software package into a
tab-delimited txt file that I can use in Excel. I'd like to format
the txt file in Excel so that it is in the proper format to be
imported into a different accounting software package.

I've gotten things to a point and now I need a macro that will insert
2 blank line between each row. I've been able to find a macro that
inserts 1 blank line, but I need two rows and I don't know how to read
the code.

Now I've got the records formatted with 1 line of data followed 2
blank rows inserted, I need the data in cells B,C, and F copied to the
first blank row and I need the data from column E cut and pasted into
the first blank row. There is an entirely blank row inbetween each
record.

A B C D F
B C E F
(blank row)

I need this macro to perform this modification on every record in the
worksheet, and I don't know how to write a loop within an Excel
macro.

Any help out there?
 
B

Bob Phillips

Hi Josh,

Some

Sub ReOrganise()
Dim cRows As Long
Dim i As Long

cRows = Cells(Rows.Count, "A").End(xlUp).Row
For i = cRows To 1 Step -1
With Cells(i, "A")
.Offset(1, 0).Resize(2).EntireRow.Insert
.Offset(0, 1).Copy .Offset(1, 1)
.Offset(0, 2).Copy .Offset(1, 2)
.Offset(0, 4).Copy .Offset(1, 4)
.Offset(0, 5).Copy .Offset(1, 5)
.Offset(0, 4).Value = ""
End With
Next i
End Sub

--

HTH

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

Lori Jo Vincent

Thank you so much for putting this post out. This helped
me with a problem I was having.

I receive a very ugly TXT report file that isn't
formatted to be of any use. I used these instructions to
re-organize the data to columns to the right of the
existing data, re-sorted and pulled out what I was after.

-- L J
 
B

Bob Phillips

Excellent, two in one<vbg>

--

HTH

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

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