Fill in the variable starting line

I'm not sure how to populate a string of variables. For example, sometimes it starts at 40,000, sometimes it starts at 50,000.

Here's what it looks like right now

Selection.End(xlUp).Select
Selection.AutoFill Destination:=Range("A40958:A43550")
Range("A40958:A43550").Select

I know how to fill up to the last line, but I'm not sure how to get the first number and variables. In column A, I go to the last cell and then fill. How to express it?

+4
source share
1 answer

Scrap .AutoFilland use the Range.FillDown Method , defining the start and end borders of the range in the same way as if you selected cells and pressed Ctrl+ D.

dim rw as long
rw = 40000
with activesheet
    .range("A" & rw, "A" & .cells(rows.count, "B").end(xlup).row).FillDown
end with

This will populate A from row 40,000 to the extents (last cell used) of column B.

+4

Source: https://habr.com/ru/post/1584377/


All Articles