• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

value in desired cell

jack999

Member
I would like to define these value should come at "G15" or desired cell, how to mention that in vba
ie following should come at G15 onwards
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25
6 12 18 24 30
7 14 21 28 35
8 16 24 32 40
9 18 27 36 45
10 20 30 40 50


Sub RangeObjects()
Dim i As Integer, j As Integer
For i = 1 To 10
For j = 1 To 5
Cells(i, j).Value = i * j
Next j
Next i
End Sub
 
Last edited:
Code:
Sub RangeObjects()
Dim i As Integer, j As Integer
For i = 1 To 10
  For j = 1 To 5
  Cells(14 + i, 6 + j).Value = i * j
  Next j
Next i
End Sub
 
Hi !

Another way :​
Code:
Sub Demo()
[G15:K24].Value = [{1,2,3,4,5;2,4,6,8,10;3,6,9,12,15;4,8,12,16,20;5,10,15,20,25;6,12,18,24,30;7,14,21,28,35;8,16,24,32,40;9,18,27,36,45;10,20,30,40,50}]
End Sub
 
or

Code:
Sub RangeObjects()
Dim i As Integer, j As Integer
For i = 15 To 25
  For j = 6 To 10
  Cells( i,  j).Value = (i-14) * (j-5)
  Next j
Next i
End Sub
 
Select Cells G15:K24
=(ROW(15:25)-14)*(COLUMN(G:K)-6) Ctrl+Shift+Enter
 
Or

Code:
Sub M_Table()
  [G15:K24] = [row(1:10)*Column(1:5)]
End Sub

or

In VBA in the immediate window

[G15:K24] = [row(1:10)*Column(1:5)]
 
Back
Top