0

Hi all,

I'm trying to do something simple, but I've been away from writing any code for so long (and I wasn't that good at it to begin with) and I am trying to generate a rectangular arry in excel using a VB macro. For simplification, what I would like to do is generate a 3x3 matrix and then populate say columns A and B with:

A B

0 0

0 1

0 2

1 0

1 1

.....


2 2


Anyway, any help would be greatly appreciated. For what it is worth, I am trying to populate a ProEngineer table pattern and I need a pretty big rectangular array and am struggling with generating that array in excel for importing to ProE so I am not cheating on a test or anything here. :)

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Jx_Man
0

My poor attempt thus far:

Sub FillRange()
Num = 0
For row = 1 To 10
For col = 1 To 10
Sheets("Sheet1").Cells(row, col).Value = Num
Num = Num + 1
Next col
Next row
End Sub

Edited by Phil2:3: n/a

0

My poor attempt thus far:

Sub FillRange()
Num = 0
For row = 1 To 10
For col = 1 To 10
Sheets("Sheet1").Cells(row, col).Value = Num
Num = Num + 1
Next col
Next row
End Sub

Any error here?
Is this your all code?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.