View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
nenad nenad is offline
external usenet poster
 
Posts: 3
Default Using Arrays to Fill a Range

On Feb 24, 9:36 pm, "Bob Phillips" wrote:
ANother way

Sub TestAlt2()
With ActiveCell
.Offset(0, 0).Resize(441).Formula = "=-10+(INT((ROW()-1)/21))"
.Offset(0, 1).Resize(441).Formula =
"=-11+MOD(ROW(),21)+(MOD(ROW(),21)=0)"
.Offset(0, 2).Resize(441).Value = 20
.Offset(0, 0).Resize(441, 2).Value = .Offset(0, 0).Resize(441,
2).Value
End With
End Sub

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"nenad" wrote in message

ps.com...



Here is a type of code that I am using now. myX, myY and myZ are
filled 'by force' down to rows and is extremely slow. How to make a
code to insert these values into an array and then transfer the
contents of the array to the range?


Code:
  Sub Test()
Code:

     i = 10
     j = 10
     For myX = -i To i
         For myY = -j To j
             myZ = i + j
             ActiveCell.Value = myX
             ActiveCell.Offset(0, 1).Value = myY
             ActiveCell.Offset(0, 2).Value = myZ
             Cells(ActiveCell.RoW + 1, 1).Select
         Next myY
     Next myX
  End Sub
  
- Hide quoted text -

- Show quoted text -


Hey Bob,

Thanks a lot man. I can't explain how much I appreciate this. This
first option worked perfect.