Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default array instead of replace feature?

Is it possible to use an array to load a range, find a value and replace it
with another value, and return the range back to the original cells?
Using the find/replace feature is very slow.
Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default array instead of replace feature?

1. how big of a range are you talking about?
2. find is very fast in my opinion, post some code.

turn off calculation and screenupdating, execute your find, then turn it back
on.

--


Gary


"MasOMenos" wrote in message
...
Is it possible to use an array to load a range, find a value and replace it
with another value, and return the range back to the original cells?
Using the find/replace feature is very slow.
Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default array instead of replace feature?

Whilst you can achieve the same in VBA:

Private Sub CommandButton3_Click()
Dim arrRange As Variant
Dim i As Long, j As Long

arrRange = Range("A1:B4")

For i = LBound(arrRange, 1) To UBound(arrRange, 1)
For j = LBound(arrRange, 2) To UBound(arrRange, 2)
arrRange(i, j) = Replace(arrRange(i, j), " & ", "&")
Next
Next

Range("A1:B4") = arrRange

End Sub

I cannot see this would be faster than
Range("A1:B4").Replace " & ", "&"

Or are you doing something else ?

NickHK

"MasOMenos" wrote in message
...
Is it possible to use an array to load a range, find a value and replace

it
with another value, and return the range back to the original cells?
Using the find/replace feature is very slow.
Thanks!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default array instead of replace feature?

Hi Nick,

The 'Private Sub CommandButton3_Click()' is very fast and is perfect!
It's actually much much faster than: Range("A1:B4").Replace " & ", "&"

The range I have is very large and it's only part of the procedure.

How did you learn so much about arrays?

Thanks,

Gunther

"NickHK" wrote:

Whilst you can achieve the same in VBA:

Private Sub CommandButton3_Click()
Dim arrRange As Variant
Dim i As Long, j As Long

arrRange = Range("A1:B4")

For i = LBound(arrRange, 1) To UBound(arrRange, 1)
For j = LBound(arrRange, 2) To UBound(arrRange, 2)
arrRange(i, j) = Replace(arrRange(i, j), " & ", "&")
Next
Next

Range("A1:B4") = arrRange

End Sub

I cannot see this would be faster than
Range("A1:B4").Replace " & ", "&"

Or are you doing something else ?

NickHK

"MasOMenos" wrote in message
...
Is it possible to use an array to load a range, find a value and replace

it
with another value, and return the range back to the original cells?
Using the find/replace feature is very slow.
Thanks!




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
Excel Find and Replace Problem with Array Steven Lee Excel Programming 1 April 18th 07 04:41 PM
Replace Input box with Project Array GregR Excel Programming 0 May 10th 06 07:48 PM
find and replace - replace data in rows to separated by commas msdker Excel Worksheet Functions 1 April 15th 06 01:00 AM
Can the "Find and Replace" feature be used in Formulas somehow? Tennfour Excel Worksheet Functions 2 February 13th 06 08:49 PM
Replace function with array formula Don[_18_] Excel Programming 2 August 7th 04 03:14 AM


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