D
D
Diana Stoyka2020-11-24 10:57:29
Visual Basic
Diana Stoyka, 2020-11-24 10:57:29

Excel VBA code. How to write diagonally in a table?

I'm new to VBA, and right now I don't know how to make Cells fill with numbers from 1 to 10 diagonally,
as in the image; if possible, with code.
5fbcbc892b76c387705791.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory Boev, 2020-11-24
@Dianka05

Sub FillRange()
    Dim i As Integer
    
    For i = 1 To 10
        Cells(i, i).Value = i
    Next i
End Sub

If you need on a specific sheet, then you still need
Worksheets("Лист1").Cells(i, i).Value = i

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question