Im trying to find the range on a separate sheet.
Dim abc As Range
Dim size As Integer
size = Sheets("Misc").Cells(1, Sheets("Misc").Cells(1, 1).Rows.End(xlDown).Count)
abc = Sheets("Misc").Range("A1:A" & size)
Im struggling to get the 'size' to give me the count of the rows correctly. What am I doing wrong?
You will need to Set
the range.
dim sz as LONG
with Sheets("Misc")
sz = .Cells(rows.count, 1).End(xlUp).Row
SET abc = .Range("A1:A" & sz)
end with
The row number should be sufficient. You don't really need a .Count
for your purposes. Just find the last populated row by looking from the bottom up.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.