Macro help needed

O

Old_skills_lost

I have created a macro in 2007 and it is having someproblems in 2003 and I
cannot find the problem in the macro. Can someone help me please. Thank you
ahead

Sub Activities()
Dim cell As Range
Count = 0
Do While Count < 296
Count = Count + 1
Sheets("First Quarter Activities").Activate
For Each cell In Range("g4:g300")
If cell.Text = "won" Then
cell.Select
Rows(cell.Row).Cut
Sheets("Won").Activate
Range("A4").Activate
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False
Sheets("First Quarter Activities").Activate
Else
If cell.Text = "lost" Then
cell.Select
Rows(cell.Row).Cut
Sheets("Lost").Activate
Range("A4").Activate
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False
Sheets("First Quarter Activities").Activate
End If
End If
Next cell
Loop
End Sub
 
J

Jim Thomlinson

What's the problem? Does it not run? Does it not do what it is supposed to do?
 
D

Don Guillett

The trick is to work from the bottom up. Try this instead

Sub activites1()
On Error Resume Next
For i = cells(rows.count,"g").end(xlup).row To 4 Step -1
Select Case UCase(Cells(i, "g"))
Case Is = "W": sh = "Won"
Case Is = "L": sh = "Lost"
Case Else
End Select
Rows(i).Cut
Sheets(sh).Range("A4").Insert Shift:=xlDown
Next i
End Sub
 

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