I am trying to insert numbers 11 through 18 in the range B2:F2. I almost got it, except that it doesn't work. Can somebody point me on the right track and tell me what am I doing wrong? thank you
here is my code :
Private Sub CommandButton1_Click() Dim intr(2 To 2, 2 To 6) As Single Dim row As Integer, col As Integer, nn As Integer For nn = 11 To 18 For col = 2 To 2 For row = 2 To 6 Cells(col, row).Value = intr(col, row) intr(col, row) = nn Next row Next col Next nn End Sub
Last edited by ilya49; 07-26-2011 at 09:15 PM.
Hi ilya49, I am a little confused, sorry. You want to fit 11 to 18 (8 separate numbers) into range B2:F2 (5 columns). The following code will put 11 to 18 into the range B2:I2Is this what you really wanted?Sub ilya49() Dim colNum As Long, rowNum As Long colNum = 1 For nm = 11 To 18 colNum = colNum + 1 Sheets(4).Cells(2, colNum).Value = nm Next nm End Sub
Please leave a message after the beep!
Thank You
that's exactly what I needed.
You're welcome!
Please leave a message after the beep!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks