Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dim rng as range
- with thisworkbook '<~~ possibly set an external workbook
- with .worksheets("sheet1")
- set rng = .range(cells(2, 1), cells(rows.count, 1).end(xlup))
- end with
- end with
- Run-tim error '1004': Application-defined or object-defined error
- dim rng as range
- with 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 with
- end with
- debug.print rng.address(0, 0, external:=true)
- dim rng as range
- with 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 with
- end with
- debug.print rng.address(0, 0, external:=true)
- '~~> This code fails
- set rng = range(.cells(2, 1), .cells(rows.count, 1).end(xlup))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement