Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I use a message box in my macro that delivers a cell address. This aspect of
the macro work well. The following line I think is the problem: ActiveCell.Offset(1, 0).Resize(1, 17).ClearContents It clears the row below the one required. Is Offset the correct way to go? AlexW |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
The correct formula depends on what you want to do and in your example below
the 'offset' statement makes Excel select the next cell down from the active cell and you then resize that selection to 17 cells. The 1 in the resize statement isn't strictly necessary. If you simply want to resize from the active cell use ActiveCell.Resize(, 17).ClearContents Mike "Alex.W" wrote: I use a message box in my macro that delivers a cell address. This aspect of the macro work well. The following line I think is the problem: ActiveCell.Offset(1, 0).Resize(1, 17).ClearContents It clears the row below the one required. Is Offset the correct way to go? AlexW |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks Mike, it works a treat.
AlexW "Mike H" wrote: The correct formula depends on what you want to do and in your example below the 'offset' statement makes Excel select the next cell down from the active cell and you then resize that selection to 17 cells. The 1 in the resize statement isn't strictly necessary. If you simply want to resize from the active cell use ActiveCell.Resize(, 17).ClearContents Mike "Alex.W" wrote: I use a message box in my macro that delivers a cell address. This aspect of the macro work well. The following line I think is the problem: ActiveCell.Offset(1, 0).Resize(1, 17).ClearContents It clears the row below the one required. Is Offset the correct way to go? AlexW |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You want to preserve the activecell contents and delete 17 cells to the right?
ActiveCell.Offset(0, 1).Resize(1, 17).ClearContents Gord Dibben MS Excel MVP On Tue, 8 Apr 2008 21:01:00 -0700, Alex.W wrote: I use a message box in my macro that delivers a cell address. This aspect of the macro work well. The following line I think is the problem: ActiveCell.Offset(1, 0).Resize(1, 17).ClearContents It clears the row below the one required. Is Offset the correct way to go? AlexW |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
macro offset cell value and sum | Excel Discussion (Misc queries) | |||
offset macro based on multiple criteria | Excel Discussion (Misc queries) | |||
How can I delete a macro when the Delete button is not active? | Excel Worksheet Functions | |||
How do i delete a macro in Excel 2003 when delete isn't highlight | Excel Discussion (Misc queries) | |||
macro to search and replace with offset | Excel Discussion (Misc queries) |