就是。在.范围内,必要时由.Cells定义?
dim rng as rangewith thisworkbook '<~~ possibly set an external workbook with .worksheets("sheet1") set rng = .range(cells(2, 1), cells(rows.count, 1).end(xlup)) end withend with
Run-tim error '1004': Application-defined or object-defined error
.Cells
Cells
.
dim rng as rangewith thisworkbook '<~~ possibly set an external workbook with .worksheets("sheet1") ' define rng as Sheet1!A2 to the last populated cell in Sheet1!A:A set rng = .range(.cells(2, 1), .cells(rows.count, 1).end(xlup)) '<~~ .range end withend withdebug.print rng.address(0, 0, external:=true)
dim rng as rangewith thisworkbook '<~~ possibly set an external workbook with .worksheets("sheet1") ' define rng as Sheet1!A2 to the last populated cell in Sheet1!A:A set rng = range(.cells(2, 1), .cells(rows.count, 1).end(xlup)) '<~~ range not .range end withend withdebug.print rng.address(0, 0, external:=true)
.range
.range([A1])
A1
.
慕哥9229398
PIPIONE