以下是引用大灰狼在2009-12-3 14:12:00的发言:
Sub Turn() Dim RoMax As Byte Dim Ro As Byte Dim Col As Byte Dim ColMax Dim Cnt As Byte With ThisWorkbook.Sheets(1) .UsedRange.Clear RoMax = Application.InputBox("Input max row:", Default:=20) ColMax = (56 \ RoMax) * 2 + 1 For Col = 1 To ColMax Step 2 For Ro = 1 To RoMax ' Cnt = (Col \ 2) * RoMax + Ro'这个地方其实都不用这样计算,可以直接从1开始计数了,所以简化成cnt=cnt+1 Cnt = Cnt + 1 If Cnt = 57 Then Exit Sub .Cells(Ro, Col).Interior.ColorIndex = Cnt .Cells(Ro, Col + 1) = Cnt Next Ro Next Col End With End Sub 这个思路和我一样 [em01] |