返回列表 上一主題 發帖

[發問] 如何在A欄 自動填上編號

回復 1# aoss98
  1. Sub nn()
  2. Set Rng = Range([B1], [B65536].End(xlUp)).SpecialCells(xlCellTypeConstants)
  3. For i = 1 To Rng.Areas.Count
  4.    Set a = Rng.Areas(i)
  5.    For Each b In a
  6.       b.Offset(, -1) = i
  7.    Next
  8. Next
  9. End Sub
複製代碼
學海無涯_不恥下問

TOP

回復 8# john2006168
  1. Sub nn()
  2. Dim Rng As Range
  3. [A10].Insert xlToRight
  4. [A10] = "plt no"
  5. Set Rng = Range([A11], [A65536].End(xlUp)).SpecialCells(xlCellTypeConstants)
  6. For i = 1 To Rng.Areas.Count
  7. mystr = Rng.Areas(i).Address
  8.    Rng.Areas(i).Insert xlToRight
  9.    Range(mystr).Value = i
  10. Next
  11. Range([A11], [A65536].End(xlUp)).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
  12. End Sub
複製代碼
學海無涯_不恥下問

TOP

回復 10# john2006168
  1. Sub nn()
  2. Dim Rng As Range
  3. [A10].Insert xlToRight
  4. [A10] = "plt no"
  5. Set Rng = Range([A11], [A65536].End(xlUp)).SpecialCells(xlCellTypeConstants)
  6. For i = 1 To Rng.Areas.Count
  7. mystr = Rng.Areas(i).Address
  8.    Rng.Areas(i).Insert xlToRight
  9.    Range(mystr).Value =format( i,"'00")
  10. Next
  11. Range([A11], [A65536].End(xlUp)).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
  12. End Sub
複製代碼
學海無涯_不恥下問

TOP

        靜思自在 : 欣賞別人就是莊嚴自己。
返回列表 上一主題