ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Quickly Update Range (https://www.excelbanter.com/excel-programming/345044-quickly-update-range.html)

MDW

Quickly Update Range
 
What's the quickest, most efficient way to do something to every cell in a
range? I've got a range of cells, and I want to do one of the following
depending on user params:

1) replace every value with an apostrophe and the value (coercing it to a
text data type for Access import)
2) replace every value with the Val() of that value (replacing blank cells
with 0, again for Access import)

I'm conversant with the "For Each C In objR.Cells" loop, but I've got
20,000+ rows and this loop is taking too long.

Any other suggestions that would accomplish the same thing would be greatly
apperciated.
--
Hmm...they have the Internet on COMPUTERS now!

Toppers

Quickly Update Range
 
Hi,
Probably the quickest way is to read the range into a variant
array, perform your calculations and transfer the variant array back to the
range.

A very simple emulation of your requirements for 30,000 rows and 50 columns
took less than 10 secs.

Is this performance acceptable?

HTH
"MDW" wrote:

What's the quickest, most efficient way to do something to every cell in a
range? I've got a range of cells, and I want to do one of the following
depending on user params:

1) replace every value with an apostrophe and the value (coercing it to a
text data type for Access import)
2) replace every value with the Val() of that value (replacing blank cells
with 0, again for Access import)

I'm conversant with the "For Each C In objR.Cells" loop, but I've got
20,000+ rows and this loop is taking too long.

Any other suggestions that would accomplish the same thing would be greatly
apperciated.
--
Hmm...they have the Internet on COMPUTERS now!



All times are GMT +1. The time now is 06:32 AM.

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