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. :)

Recommended Answers

All 2 Replies

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

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.