Offset VBA Problem

J

jlclyde

I am writting code to clear an area of a spread sheet. I have the
upper left hand cell selected, but I need to be able to offset from
this point and go down 6 rows and 6 columns. So instead of just
selecting A1 it woudl select A1:F7.

Thanks in advance,
Jay
 
J

JE McGimpsey

One way:

Range("A1").Resize(7, 6).ClearContents

Note that you almost never need to select a range - working directly
with the range object makes your code smaller, faster, and IMO, easier
to maintain...
 
E

Earl Kiosterud

Jay,

Range(Selection, Cells(Selection.Row + 6, Selection.Column + 6)).Select
Or more easily
Selection.Resize(6, 6).Select

You might want to put questions like these in microsoft.public.excel.programming

--
Regards from Virginia Beach,

Earl Kiosterud
www.smokeylake.com

Note: Top-posting has been the norm here.
Some folks prefer bottom-posting.
But if you bottom-post to a reply that's
already top-posted, the thread gets messy.
When in Rome...
 
J

jlclyde

One way:

Range("A1").Resize(7, 6).ClearContents

Note that you almost never need to select a range - working directly
with the range object makes your code smaller, faster, and IMO, easier
to maintain...




- Show quoted text -

Thank you for the help. I will keep that in mind when writting future
code.
Jay
 

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

Top