Range Select with ActiveCell and Offset property

  • Thread starter Thread starter AJ Master
  • Start date Start date
A

AJ Master

I need to clear the contents of a certain range and yes I could jus
write the code as follows: Range("a1:b240").clearcontents

however, the range selection depends on the active cell. I have trie
entering the following: Range(activecell
activecell.offset(1,240)).clearcontents
But I keep receiving a runtime error '1004'. Any ideas on how to fi
this? Thanks....A
 
There are only 256 columns (unless you are beta testing the new XL). You are
offsetting by 256 columns, which means there is a good possibility that you
are offsetting right off the end of the sheet, which would generate that
error.
 
Jim

Thanks.....you were quite right. It should have been (240,1) and no
(1,240). I think the brains had too much VBA today. :)
Thanks...again! ...A
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top