EXCEL 請問 A欄 1001110000111........ 如何用VBA在C1變成寫出A D1=B,D2=B E1=A,E2=A,E3=A 以此類推,還請指導謝謝?

2019-05-04 6:51 pm

回答 (1)

2019-05-06 12:27 pm
✔ 最佳答案
If Cells(1, 1) = 1 Then
Cells(1, 3) = "A"
Else
Cells(1, 3) = "B"
End If

x = 1
y = 3
For i = 2 To [A65536].End(3).Row
If Cells(i, 1) = 1 Then
Rx = "A"
Else
Rx = "B"
End If

If Cells(i, 1) = Cells(i - 1, 1) Then
Cells(x + 1, y) = Rx
x = x + 1
Else
y = y + 1
Cells(1, y) = Rx
x = 1
End If

Next


收錄日期: 2021-05-03 06:48:57
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20190504105127AAesm0T

檢視 Wayback Machine 備份