View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
jasontferrell jasontferrell is offline
external usenet poster
 
Posts: 56
Default Efficiency of Code Help

It's difficult to test without data, but here's an attempt.

Sub DataMove()
RowCount = 1
With ActiveSheet
For RowCount = 1 To .UsedRange.Rows.Count
If .Cells(RowCount, 2).Value Like "*Ask Jeeves organic*" Or _
.Cells(RowCount, 2).Value Like "*Unified Sources
(evar17)*" Or _
.Cells(RowCount, 2).Value Like "*Google organic*" Or _
.Cells(RowCount, 2).Value Like "*Microsoft Bing
organic*" Or _
.Cells(RowCount, 2).Value Like "*Live.com organic*" Or
_
.Cells(RowCount, 2).Value Like "*Yahoo! organic*" Or _
.Cells(RowCount, 2).Value Like "*AOL.com Search
organic*" Then
.Cells(RowCount, 19).Value = .Cells(RowCount, 2).Value
.Cells(RowCount, 20).Value = .Cells(RowCount, 2).Offset(0,
1).Value
.Cells(RowCount, 21).Value = .Cells(RowCount, 2).Offset(0,
2).Value
.Cells(RowCount, 22).Value = .Cells(RowCount, 2).Offset(0,
3).Value
.Cells(RowCount, 18).Value = .Cells(RowCount, 2).Offset(0,
-1).Value
End If
If .Cells(RowCount, 18).Value = (.Range("A" & Rows.Count).End
(xlUp)) - 1 Or _
.Cells(RowCount, 18).Value = "Date" Then
.Cells(RowCount, 7).Value = .Cells(RowCount, 18).Value
.Cells(RowCount, 8).Value = .Cells(RowCount, 18).Offset(0,
1).Value
.Cells(RowCount, 9).Value = .Cells(RowCount, 18).Offset(0,
2).Value
.Cells(RowCount, 10).Value = .Cells(RowCount, 18).Offset
(0, 3).Value
.Cells(RowCount, 11).Value = .Cells(RowCount, 18).Offset
(0, 4).Value
End If
Next RowCount
.Range("P1").Value = (.Range("A" & Rows.Count).End(xlUp)) - 1
.Range("R1:V500").Delete
.Range("P1:P1").Delete
.UsedRange.AutoFormat
End With
End Sub