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: 396
Default Help needed to speed code up

Hi all,
I have code below that i got of this site to compare columns "L" & "H"
and put the difference in "K" if no value in "L" then nothing. However
the code is very slow on large spreadsheets of more than 5000 lines.
Could somebody please help to improve the code to make it work faster ??


Sub InsPriceDiff()
'
Dim rng As Range, cell As Range
Dim mynum As Variant
Dim i As Long
Dim numRows As Long
Dim LastRow As Long
Set rng = Range(Range("H4"), Range("H4").End(xlDown))
For Each cell In rng
If cell.Offset(0, 4) < cell.Value And Not
IsEmpty(cell.Offset(0, 4)) Then
mynum = cell.Offset(0, 0) - cell.Offset(0, 4)
cell.Offset(0, 3) = mynum
End If
Next
End Sub


Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
 
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
Need to Speed Up A Code LostInNY Excel Worksheet Functions 2 July 20th 09 06:18 PM
Speed up Code? Sige Excel Programming 4 July 27th 05 06:21 PM
Speed up code Derick Hughes Excel Programming 0 February 8th 05 04:18 PM
Code Speed Up lists[_2_] Excel Programming 3 August 10th 04 12:06 PM


All times are GMT +1. The time now is 07:28 AM.

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

About Us

"It's about Microsoft Excel"