开发者

Excel copy x amount of columns below one cell

开发者 https://www.devze.com 2023-03-02 17:07 出处:网络
I am dealing with a chang开发者_运维技巧ing file and I would like to copy the last 10 rows of a certain column and then paste it into another worksheet, the original worksheet gets updated throughout

I am dealing with a chang开发者_运维技巧ing file and I would like to copy the last 10 rows of a certain column and then paste it into another worksheet, the original worksheet gets updated throughout the day.


Const COLUMN_INDEX = 1 ' Desired column

Sub CopyValues()
    Dim LastRow = [A65536].End(xlUp).Row ' Find the last row index
    Dim I
    For I = LastRow - 10 To LastRow
        'Do something with Cells(I, COLUMN_INDEX).Value
    Next I
End Sub
0

精彩评论

暂无评论...
验证码 换一张
取 消