就是。在.范围内,必要时由.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 withRun-tim error '1004': Application-defined or object-defined error
.CellsCells
.
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
随时随地看视频慕课网APP