Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delay when writing cell information to Excel from VBA Macro

When I loop through in VBA setting a value for a variable the loop goes
fast. When I use cell(i,j).value to put the value in a cell there is about a
1 second delay between each cell. For 250 cells it is a long wait. Is there
any way to control this wait?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Delay when writing cell information to Excel from VBA Macro

add
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

to the beginning of your code

and

Application.ScreenUpdating = true
Application.Calculation = xlCalculationAutomatic

at the end

--


Gary

"Dick HSV" <Dick wrote in message
...
When I loop through in VBA setting a value for a variable the loop goes
fast. When I use cell(i,j).value to put the value in a cell there is about a
1 second delay between each cell. For 250 cells it is a long wait. Is there
any way to control this wait?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delay when writing cell information to Excel from VBA Macro

Gary,

Thanks alot. New to Excel macros - was stumped.

Dick HSV

"Gary Keramidas" wrote:

add
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

to the beginning of your code

and

Application.ScreenUpdating = true
Application.Calculation = xlCalculationAutomatic

at the end

--


Gary

"Dick HSV" <Dick wrote in message
...
When I loop through in VBA setting a value for a variable the loop goes
fast. When I use cell(i,j).value to put the value in a cell there is about a
1 second delay between each cell. For 250 cells it is a long wait. Is there
any way to control this wait?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Delay when writing cell information to Excel from VBA Macro

Also, read the range directly into a VB array, and if necessary, loop
through the array in memory. Then write the entire array to a range in one
step.

Sample Usage:

Reading:
Dim vArray As Variant ' must be "variant" to read range into VBA array
vArray = ActiveSheet.Range("A1:D10").Value

Writing:
' can be array of any variable type
ActiveSheet.Range("A1:D10").Value = myArray

This will produce a great improvement in execution speed, particularly
writing back to the sheet.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"Gary Keramidas" <GKeramidasAtMsn.com wrote in message
...
add
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

to the beginning of your code

and

Application.ScreenUpdating = true
Application.Calculation = xlCalculationAutomatic

at the end

--


Gary

"Dick HSV" <Dick wrote in message
...
When I loop through in VBA setting a value for a variable the loop goes
fast. When I use cell(i,j).value to put the value in a cell there is
about a
1 second delay between each cell. For 250 cells it is a long wait. Is
there
any way to control this wait?





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
writing information but not having it look like a table? marrie New Users to Excel 4 September 23rd 06 05:11 PM
Need help writing Excel macro to solve a cell in each row of a spreadsheet Chris Excel Programming 5 September 10th 05 01:39 AM
When writing a macro in excel workbook, how do I refer to ea cell Diana Bartz Excel Programming 1 July 7th 05 09:51 PM
writing information from a userform to an excel sheet mike Excel Programming 1 June 28th 05 08:57 PM
Delay/Slow a Macro In Excel 2003 Kara Excel Worksheet Functions 1 February 11th 05 11:39 PM


All times are GMT +1. The time now is 03:47 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"