컴퓨터/엑셀

vba 행번호매기기

풍경소리^^ 2018. 6. 6. 10:32

Sub 행값매기기()
Dim rng As Range
Dim rowsCnt As Integer
    rowsCnt = Cells(Rows.Count, "d").End(3).Row
    Set rng = Range(Cells(2, "AC"), Cells(rowsCnt, "AC"))
    Range(Cells(2, "AC"), Cells(Rows.Count, "AC")).ClearContents
   
    rng.Formula = "=ROW()-1"
    rng.Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    Cells(2, "AC").Select
   
End Sub

'컴퓨터 > 엑셀' 카테고리의 다른 글

vba 공백행지우기  (0) 2018.06.14
반복인쇄  (0) 2018.06.07
vba countif 함수 현재행  (0) 2018.06.06
vba countifs 함수 "문자"  (0) 2018.06.06
vba countifs  (0) 2018.06.04