输出生成问题(代码运行)

时间:2019-07-17 11:57:27

标签: excel vba

我正在尝试从单行范围内绘制对角线。当我第一次运行代码时,它生成了值,但是当我再次尝试时,代码运行了,但是没有生成输出。有什么建议吗?

Sub diagonal()

    Dim i As Integer, rng As Range, col As Integer, ro As Integer
    Set rng = Range("C32:L32").Rows(32).CurrentRegion
    Dim cell As Range
    col = 25
    ro = 37
    For Each cell In rng
        col = col - 1
        ro = ro + 1
        cell.Value = cell(ro, col)
    Next cell

End Sub

0 个答案:

没有答案