![]() |
Offset VBA Problem
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 |
Offset VBA Problem
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... In article . com, jlclyde wrote: 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 |
Offset VBA Problem
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... ----------------------------------------------------------------------- "jlclyde" wrote in message ups.com... 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 |
Offset VBA Problem
On Sep 18, 9:53 am, JE McGimpsey wrote:
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... In article . com, jlclyde wrote: 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- Hide quoted text - - Show quoted text - Thank you for the help. I will keep that in mind when writting future code. Jay |
All times are GMT +1. The time now is 11:56 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com