Hi, I would like my code to show on an additional sheet when I run it. When I try to run my code, my excel just bug. Can you help me please? Thanks
Sub Question4()
Dim mA(1 To 100, 1 To 100) As Integer
Dim i As Integer
Dim j As Integer
For i = 1 To 100
For j = 1 To 100
mA(i, j) = i - j
If i - j = 1 Or i - j = -1 Then
mA(i, j) = 1
Else
mA(i, j) = 0
End If
ActiveWorkbook.Sheets.Add.Cells(i, j) = mA(i, j)
Next j
Next i
End Sub
Sub Question4()
Dim mA(1 To 100, 1 To 100) As Integer
Dim i As Integer
Dim j As Integer
For i = 1 To 100
For j = 1 To 100
mA(i, j) = i - j
If i - j = 1 Or i - j = -1 Then
mA(i, j) = 1
Else
mA(i, j) = 0
End If
ActiveWorkbook.Sheets.Add.Cells(i, j) = mA(i, j)
Next j
Next i
End Sub