关于“excel、批处理、C语言”自定义函数拜托各位大神

2025-03-12 22:13:33
推荐回答(1个)
回答1:

EXCEL 表格[A1]...[A999] 测试数据,一行一个 A001:=AB('001A','E',1) A002:=AB('002A','E',1) A003:=AB('003A','E',1) A010:=AB('010A','E',1) A111:=AB('111A','E',1) EXCEL VBA 代码 Private Sub CommandButton1_Click() For i = 1 To 999 If Cells(i, 1) = "" Then Exit For If Int(Mid(Cells(i, 1), 2, 3)) < 9 Then Cells(i, 1) = "A00" & Mid(Cells(i, 1), 2, 3) + 1 & ":=AB('00" & Mid(Cells(i, 1), 11, 3) + 1 & "A','E',1)" ElseIf Int(Mid(Cells(i, 1), 2, 3)) > 9 And Int(Mid(Cells(i, 1), 2, 3)) < 99 Then Cells(i, 1) = "A0" & Mid(Cells(i, 1), 2, 3) + 1 & ":=AB('0" & Mid(Cells(i, 1), 11, 3) + 1 & "A','E',1)" ElseIf Int(Mid(Cells(i, 1), 2, 3)) > 99 And Int(Mid(Cells(i, 1), 2, 3)) < 999 Then Cells(i, 1) = "A" & Mid(Cells(i, 1), 2, 3) + 1 & ":=AB('" & Mid(Cells(i, 1), 11, 3) + 1 & "A','E',1)" End If Next End Sub