LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default A faster code maybe?

These both do the same work (different column on sheet4) and seem to have no speed advantage either way.

Is code 1 properly written or can it be made faster.

Howard

Sub Column_OneRng1()
Dim LRow As Long, i As Long
Dim varData As Variant

Application.ScreenUpdating = False
With Sheets("Sheet3")
LRow = .Cells(Rows.Count, 4).End(xlUp).Row
varData = .Range("A2:F" & LRow)
For i = 1 To UBound(varData)
If varData(i, 4) < 150 Then
Sheets("Sheet4").Cells(Rows.Count, 1) _
.End(xlUp)(2) = varData(i, 1)

Sheets("Sheet4").Cells(Rows.Count, 3) _
.End(xlUp)(2) = " Type-" & varData(i, 5)

Sheets("Sheet4").Cells(Rows.Count, 5) _
.End(xlUp)(2) = " Age-" & varData(i, 6)

End If
Next
End With

Application.ScreenUpdating = True

End Sub



Sub Column_OneRng2()
Dim OneRng As Range
Dim c As Range

Set OneRng = Sheets("Sheet3").Range("D2:D" & Cells(Rows.Count, "D").End(xlUp).Row)

For Each c In OneRng
If c < 150 Then
Sheets("Sheet4").Range("B" & Rows.Count).End(xlUp)(2) = c.Offset(, -3)
Sheets("Sheet4").Range("D" & Rows.Count).End(xlUp)(2) = " Type-" & c.Offset(, 1)
Sheets("Sheet4").Range("F" & Rows.Count).End(xlUp)(2) = " Age-" & c.Offset(, 2)
End If
Next
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Faster Way to Execute Code Ken Hudson Excel Programming 6 May 25th 07 06:05 AM
Faster way to code this jhahes[_63_] Excel Programming 3 July 6th 06 05:08 PM
Which is faster code... Marcotte A Excel Programming 2 October 23rd 04 01:03 AM
Lag functions or faster code Frank Fuller Excel Programming 1 October 16th 03 05:17 PM
Could this code be faster? ste mac Excel Programming 2 August 27th 03 12:59 PM


All times are GMT +1. The time now is 04:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"