LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Array <-- Range Error

Hi,
Code needs to be something like this:

Sub Test()

Dim UserRange as Range
Dim v as variant
Dim r as long, c as Integer

Set UserRange=Range("A1:AZ3000") ' Change as needed

v=UserRange

For r = 1 to Ubound(v,1)
For c = 1 to Ubound(v,2)

' Perform operation
v(r,c)="'" & v(r,c) ' Add ' to field
Next c
Next r

UserRange=v

End sub

HTH

"MDW" wrote:

In response to an answer to my earlier question, I'm trying to load the
contents of a range into an array, page through it and make some changes, and
then dump the changes back into the range. However, I seem to get a
"Subscript out of range" error whenever I try to actually change anything in
the array. Below is the relevant code:

Dim arrCols

Set objR = objWS.Range(objWS.Cells(2, J), objWS.Cells(lngCurrentRow, J))

arrCols = objR.Value

MsgBox UBound(arrCols) ' In my test ~ 8,000

arrCols(1) = 555555 ' ERROR - tried with "5555555" also

objR.Value = arrCols


--
Hmm...they have the Internet on COMPUTERS now!

 
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
Changing a range of an array in a SUMPRODUCT formula gives a #N/A error Chrism Excel Discussion (Misc queries) 4 May 4th 05 04:06 PM
Error Converting Passed Range into Array in VBA for Excel Dave Peterson[_3_] Excel Programming 0 September 1st 04 01:17 AM
Redim 2D Array Subscript Out Of Range Error lopsided[_10_] Excel Programming 6 February 11th 04 08:24 AM
Subscript Out of Range error in Array... Kevin Lyons Excel Programming 3 February 4th 04 06:17 PM
Userform array/subsript range error Bijl167[_8_] Excel Programming 1 December 9th 03 10:15 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"