Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

What is wrong with this?

  Asked By: Wayne    Date: Sep 01    Category: MS Office    Views: 831
  

Worksheets("05data").Activate
totalrows = ActiveSheet.UsedRange.Rows.Count
totalcolumns = ActiveSheet.UsedRange.Columns.Count
ActiveCell.Select
ActiveCell.Offset(totalrows, totalcolumns).Range("a1").Select

Can anyone tell me why the 5th line gives me an error. I realize that
I must be using the wrong sort of function but I can't figure out why
or how to fix it.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Sadie Black     Answered On: Sep 01


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?

 
Answer #2    Answered By: Viveka Fischer     Answered On: Sep 01

I managed to get it working and then switched to a totally different
approach and it works fine too. Thanks for the comments about my
earlier posting...

 
Didn't find what you were looking for? Find more on What is wrong with this? Or get search suggestion and latest updates.




Tagged: