Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Sheets.Cells.Value = Sheets.Cells.Value Should this be very slow?

Dear All,


Below is my code for comparing 2 lists.
As i am working in an enviroment with very small dataresources, i am
used to things being slow... However, my code is ultra slow atm. Any
ideas on speeding it up or should i call my techsupport *again* to ask
for more memory?

Dim lastRow As Long, rw As Long
Dim rngA As Range ' rngA = first list of data

Set rngA = Range(Sheets("Deltas").Cells(1, "A"),
Sheets("Deltas").Cells(Rows.Count, "A").End(xlUp))

lastRow = Sheets("ODIS").Cells(Rows.Count, "A").End(xlUp).Row ' = end
of 2nd list of records
MsgBox lastRow
'rw writes the results on Deltas
rw = Sheets("Deltas").Cells(1, "E").End(xlUp).Row
'MsgBox rw

For i = 1 To lastRow Step 1
If Application.CountIf(rngA, Sheets("Deltas").Cells(i, "F").Value)
= 0 Then
Sheets("Deltas").Cells(rw, "G").Value =
Sheets("ODIS").Cells(i, "C").Value
Sheets("Deltas").Cells(rw, "H").Value =
Sheets("ODIS").Cells(i, "E").Value
Sheets("Deltas").Cells(rw, "I").Value =
Sheets("ODIS").Cells(i, "G").Value
Sheets("Deltas").Cells(rw, "J").Value =
Sheets("ODIS").Cells(i, "H").Value
rw = rw + 1
End If
Next

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sheets.Cells.Value = Sheets.Cells.Value Should this be very slow?

On 4 Apr, 08:19, "artisdepartis" wrote:
Dear All,

Below is my code for comparing 2 lists.
As i am working in an enviroment with very small dataresources, i am
used to things being slow... However, my code is ultra slow atm. Any
ideas on speeding it up or should i call my techsupport *again* to ask
for more memory?

Dim lastRow As Long, rw As Long
Dim rngA As Range ' rngA = first list of data

Set rngA = Range(Sheets("Deltas").Cells(1, "A"),
Sheets("Deltas").Cells(Rows.Count, "A").End(xlUp))

lastRow = Sheets("ODIS").Cells(Rows.Count, "A").End(xlUp).Row ' = end
of 2nd list of records
MsgBox lastRow
'rw writes the results on Deltas
rw = Sheets("Deltas").Cells(1, "E").End(xlUp).Row
'MsgBox rw

For i = 1 To lastRow Step 1
If Application.CountIf(rngA, Sheets("Deltas").Cells(i, "F").Value)
= 0 Then
Sheets("Deltas").Cells(rw, "G").Value =
Sheets("ODIS").Cells(i, "C").Value
Sheets("Deltas").Cells(rw, "H").Value =
Sheets("ODIS").Cells(i, "E").Value
Sheets("Deltas").Cells(rw, "I").Value =
Sheets("ODIS").Cells(i, "G").Value
Sheets("Deltas").Cells(rw, "J").Value =
Sheets("ODIS").Cells(i, "H").Value
rw = rw + 1
End If
Next


If you find your code to be a bit on the slow side, then you could
always try processing the lists as arrays. Read the lists off the
worksheets, do all the comparisons and copying in an array, then write
the results back to the worksheet. Should speed things up.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Sheets.Cells.Value = Sheets.Cells.Value Should this be very slow?

Try first turning off screenupdating and switching calculation to manual (don't forget to switch back at the end)

--
Tim Williams
Palo Alto, CA


"artisdepartis" wrote in message oups.com...
Dear All,


Below is my code for comparing 2 lists.
As i am working in an enviroment with very small dataresources, i am
used to things being slow... However, my code is ultra slow atm. Any
ideas on speeding it up or should i call my techsupport *again* to ask
for more memory?

Dim lastRow As Long, rw As Long
Dim rngA As Range ' rngA = first list of data

Set rngA = Range(Sheets("Deltas").Cells(1, "A"),
Sheets("Deltas").Cells(Rows.Count, "A").End(xlUp))

lastRow = Sheets("ODIS").Cells(Rows.Count, "A").End(xlUp).Row ' = end
of 2nd list of records
MsgBox lastRow
'rw writes the results on Deltas
rw = Sheets("Deltas").Cells(1, "E").End(xlUp).Row
'MsgBox rw

For i = 1 To lastRow Step 1
If Application.CountIf(rngA, Sheets("Deltas").Cells(i, "F").Value)
= 0 Then
Sheets("Deltas").Cells(rw, "G").Value =
Sheets("ODIS").Cells(i, "C").Value
Sheets("Deltas").Cells(rw, "H").Value =
Sheets("ODIS").Cells(i, "E").Value
Sheets("Deltas").Cells(rw, "I").Value =
Sheets("ODIS").Cells(i, "G").Value
Sheets("Deltas").Cells(rw, "J").Value =
Sheets("ODIS").Cells(i, "H").Value
rw = rw + 1
End If
Next



Reply
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
format cells in 30 different sheets Pat Excel Discussion (Misc queries) 3 March 15th 07 05:38 PM
cells and sheets, names PH NEWS Excel Worksheet Functions 3 February 20th 06 03:35 PM
same info different sheets different cells kevatt[_3_] Excel Programming 0 January 10th 06 10:47 PM
On MouseOver for Cells/Sheets Andrew Excel Programming 3 September 21st 05 02:36 PM
the sum of cells of many sheets Jeff Klein[_2_] Excel Programming 2 December 9th 04 10:49 PM


All times are GMT +1. The time now is 10:55 PM.

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"