Hi Everyone,

I am a noob at vb so sorry if i do something stupid.

I am trying to auto fill a report from a log file by importing the csv file and rearranging the data.

There is lots of copy and pastes in two loops which works in debugging but is takes ages and is prone to crashing. (20 minutes to run)

Can anyone give me ideas to speed up the process.

I already have screen update and calculations update to False and manual.

Thanks in Advance.

The problem code is below:


Count = 0

Do Until (ActiveCell.Value = "")
Count2 = 0
firstaddress = ActiveCell.Address
idno = ActiveCell.Value
Cells.Find(idno, LookAt:=xlWhole).Select
ActiveCell.Offset(0, 4).Select
Set MyRange = Range(ActiveCell, ActiveCell.Offset(0, 2))
MyRange.Copy
Range("I3").Activate
ActiveCell.Offset(Count2, (Count * 3)).Activate
ActiveCell.PasteSpecial (xlPasteValues)
Count2 = Count2 + 1
Range(firstaddress).Activate
Cells.FindNext(After:=ActiveCell).Activate

    Do Until ActiveCell.Address = firstaddress
    previousaddress = ActiveCell.Address
    ActiveCell.Offset(0, 4).Select
    Set MyRange = Range(ActiveCell, ActiveCell.Offset(0, 2))
    MyRange.Copy
    Range("I3").Activate
    ActiveCell.Offset(Count2, (Count * 3)).Activate
    ActiveCell.PasteSpecial (xlPasteValues)
    Range(previousaddress).Activate
    Cells.FindNext(After:=ActiveCell).Activate
    Count2 = Count2 + 1
    Loop

Count = Count + 1

Range("A3").Activate
ActiveCell.Offset(Count, 0).Select

Loop