ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Update cell's value without refresh screen? (https://www.excelbanter.com/excel-programming/299549-update-cells-value-without-refresh-screen.html)

lantiger

Update cell's value without refresh screen?
 
I am having a hard time with a function that update cell values.

I have a function that get market data from a DLL, and it will updat
the corresponding excel cells.

It works ok, the problem is whenever a cell update, excel refresh th
entire screen, sometime values from inactive worksheet can be see i
that cell has colored background formate. I CANNOT us
application.screenupdate =true/false because of the frequency of marke
update (means this function get called maybe twice every second).
Calculation is set to manual so that should not be the problem?


Here is a snap shot of that function

Private Function UpdateCell(byval R as range, byval v as collection
byval header as string)

application.enableEvents = false

Select Case(header)

case "LAST"
'use to be R.Value = value, but cells seems to be faster
application.Worksheets(Name).Cells(R.row, R.Column).Value = v.Last
case "HIGH"
application.Worksheets(Name).Cells(R.row, R.Column).Value = v.High
case "LOW"
application.Worksheets(Name).Cells(R.row, R.Column).Value = v.Low

application.enableEvents = true

end function

Thanks for your time and any input you have. I really approciate it

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 01:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com