This is the latest image of my spreadsheet我需要使用1A,1B,1C,1D等标记细胞。基本上,当宏进行编号时,数字首先出现在字母表之前。我在这里完全颠倒了。编号从A1而不是1A开始。你能帮我纠正我的代码吗?谢谢。这些是我的代码:
Public A, B As Integer
Sub AutoOpen()
A = 1
B = 1
End Sub
Sub LabelTest()
With Selection
.HorizontalAlignment = xlCenter
SR = .Row
SC = .Column
LR = SR + .Rows.Count - 1
LC = SC + .Columns.Count - 1
End With
For Rcount = SR To LR
For CCount = SC To LC
Cells(Rcount, CCount).Value = Replace(Cells(A, B).Address, "$", "")
A = A + 1
If A = 5 Then A = 1: B = B + 1
Next
Next
End Sub
答案 0 :(得分:0)
这是这篇文章的答案:
Public A, B As Integer
Sub AutoOpen()
A = 1
B = 1
End Sub
Sub LabelTest()
With Selection
.HorizontalAlignment = xlCenter
SR = .Row
SC = .Column
LR = SR + .Rows.Count - 1
LC = SC + .Columns.Count - 1
End With
For Rcount = SR To LR
For CCount = SC To LC
Cells(Rcount, CCount).Value = B & Mid("ABCDEFGHIJKLMNOPQRSTUVWXYZ", A, 1)
A = A + 1
If A = 5 Then A = 1: B = B + 1
Next
Next
End Sub`