Works fine here.
What's the error report?
What version of Excel?
Realise that if you have a completely empty sheet apart from something
in cell J23 and something in cell M26, that totalrows will be 4 as
will totalcolumns, and that the result of the fifth line will be to
select 4 rows down and 4 columns across from wherever the active cell
happened to be when you started. If this tries to select a cell beyond
256 columns across or more than 65536 rows down you'll get error (1004
usually).
What are you aiming at?