Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, I've new to this VBA stuff, however with my limited knowledge have I made a macro which adds cells and delete cells depeding on the text in the first cell of the row. My main problem is that it takes ages, as my spreadsheet have 25.000 rows. I guess it would become quicker if I sorted all rows on the first cell, then marked all rows including "AP" in first cell and then add the cell needed. Would it be possible to get this macro time down to a minute or two instead of 60+ which is it now. Thanks guys. The macro: Sub IfLetterThen() Application.ScreenUpdating = False For i = 1 To 100 If IsEmpty(ActiveCell) = False Then ' 2003 If ActiveCell = "AP" Then ActiveCell.Offset(0, 14).Range("A1").Select Selection.Delete Shift:=xlToLeft ActiveCell.Offset(0, -14).Range("A1").Select ElseIf ActiveCell = "GL" Then ActiveCell.Offset(0, 12).Range("A1").Select Selection.Delete Shift:=xlToLeft ActiveCell.Offset(0, -12).Range("A1").Select End If End If ActiveCell.Offset(1, 0).Select Next i Application.ScreenUpdating = True End Sub -- Ctech ------------------------------------------------------------------------ Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745 View this thread: http://www.excelforum.com/showthread...hreadid=472537 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help, need to speed up this macro | Excel Discussion (Misc queries) | |||
Macro Speed | Excel Programming | |||
Speed-up a macro! | Excel Programming | |||
Speed up macro | Excel Discussion (Misc queries) | |||
Using With to speed up macro | Excel Programming |