Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to starting at a single cell selection, offset two columns and
expand the selection two two cells. So far I am using: ActiveCell.Offset(0, 2).Select Selection.Resize(0, 2).Select However, I get the runtime error: Application-defined or object-defined error Probably just another case of me using something in the wrong place but I cant see what else to do. Any help will be appreciated. Robert |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() wrote: I want to starting at a single cell selection, offset two columns and expand the selection two two cells. So far I am using: ActiveCell.Offset(0, 2).Select Selection.Resize(0, 2).Select However, I get the runtime error: Application-defined or object-defined error Probably just another case of me using something in the wrong place but I cant see what else to do. Any help will be appreciated. Robert I forgot to say that when I start the code, I have a cell selected and the error occurs on the second line of code R |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Selection.Offset(0, 2).Resize(2, 1).Select
The 'size' of a range must always be 1 or more rows and columns within the limits of the sheet size. Regards, Peter T wrote in message ups.com... I want to starting at a single cell selection, offset two columns and expand the selection two two cells. So far I am using: ActiveCell.Offset(0, 2).Select Selection.Resize(0, 2).Select However, I get the runtime error: Application-defined or object-defined error Probably just another case of me using something in the wrong place but I cant see what else to do. Any help will be appreciated. Robert |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm not sure exactly what you want to do. What are you trying to do with
'Resize '? If you just want to expand your selection to two cells after you offset two columns, which two cells should be the selection. Assuming adjacent columns: ActiveCell.Offset(0, 2).Select Range(ActiveCell, ActiveCell.Offset(0, 1)).Select If you mean you want the two cells to be merged, then maybe: ActiveCell.Offset(0, 2).Select Range(ActiveCell, ActiveCell.Offset(0, 1)).Select Selection.Merge Regards, Paul wrote in message ups.com... wrote: I want to starting at a single cell selection, offset two columns and expand the selection two two cells. So far I am using: ActiveCell.Offset(0, 2).Select Selection.Resize(0, 2).Select However, I get the runtime error: Application-defined or object-defined error Probably just another case of me using something in the wrong place but I cant see what else to do. Any help will be appreciated. Robert I forgot to say that when I start the code, I have a cell selected and the error occurs on the second line of code R |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The problem is the 0 in the resize property. This tells Excel you want to
resize the range to 0 rows high. You can't have a range with 0 rows. -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com (email address is on the web site) wrote in message ups.com... wrote: I want to starting at a single cell selection, offset two columns and expand the selection two two cells. So far I am using: ActiveCell.Offset(0, 2).Select Selection.Resize(0, 2).Select However, I get the runtime error: Application-defined or object-defined error Probably just another case of me using something in the wrong place but I cant see what else to do. Any help will be appreciated. Robert I forgot to say that when I start the code, I have a cell selected and the error occurs on the second line of code R |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
You have siad your new range has 0 rows. Try ActiveCell.Offset(0, 2).Select Selection.Resize(, 2).Select or better still ActiveCell.Offset(0, 2).Resize(, 2).Select This uses the same number of rows as ActiveCell. you could also use Resize(1,2). regards Paul wrote: wrote: I want to starting at a single cell selection, offset two columns and expand the selection two two cells. So far I am using: ActiveCell.Offset(0, 2).Select Selection.Resize(0, 2).Select However, I get the runtime error: Application-defined or object-defined error Probably just another case of me using something in the wrong place but I cant see what else to do. Any help will be appreciated. Robert I forgot to say that when I start the code, I have a cell selected and the error occurs on the second line of code R |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ahh, the light bulb is on Chip! The education continues
Thanks to all who replied Robert Chip Pearson wrote: The problem is the 0 in the resize property. This tells Excel you want to resize the range to 0 rows high. You can't have a range with 0 rows. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Selection Error | Excel Programming | |||
I could NOT resize the axis title but excel allows me to resize gr | Charts and Charting in Excel | |||
I could NOT resize the axis title but excel allows me to resize gr | Charts and Charting in Excel | |||
Resize selection made by "name" VBA | Excel Discussion (Misc queries) | |||
Selection.Sort error | Excel Programming |