PC Review


Reply
Thread Tools Rate Thread

Custom Range Method

 
 
Matthew Pfluger
Guest
Posts: n/a
 
      8th Aug 2008
I would like to write a custom method for the Range object that returns a
Range object representing all child rows of the called row. I looked in the
Object Browser, and I don't think such a method exists, but if somoeone knows
differently, please tell me!

The routine may be called like this:

Dim rng as range
set rng = Rows(1).ChildRows.Select

Is it possible to write a custom method for an existing object, or do I have
to write a similar class module (i.e. CRange) and then write the method?

Thanks,
Matthew Pfluger
 
Reply With Quote
 
 
 
 
Matthew Pfluger
Guest
Posts: n/a
 
      8th Aug 2008
Correction, I should have said CUSTOM RANGE PROPERTY, not method.

"Matthew Pfluger" wrote:

> I would like to write a custom method for the Range object that returns a
> Range object representing all child rows of the called row. I looked in the
> Object Browser, and I don't think such a method exists, but if somoeone knows
> differently, please tell me!
>
> The routine may be called like this:
>
> Dim rng as range
> set rng = Rows(1).ChildRows.Select
>
> Is it possible to write a custom method for an existing object, or do I have
> to write a similar class module (i.e. CRange) and then write the method?
>
> Thanks,
> Matthew Pfluger

 
Reply With Quote
 
David
Guest
Posts: n/a
 
      8th Aug 2008
Hi,

I am in the cell that has a formula, then,
Sub Macro1()
Selection.ShowPrecedents
Range(ActiveCell.Address).Precedents.Select
z = Selection.Address
MsgBox z
End Sub

Hope this helps.
David

"Matthew Pfluger" wrote:

> Correction, I should have said CUSTOM RANGE PROPERTY, not method.
>
> "Matthew Pfluger" wrote:
>
> > I would like to write a custom method for the Range object that returns a
> > Range object representing all child rows of the called row. I looked in the
> > Object Browser, and I don't think such a method exists, but if somoeone knows
> > differently, please tell me!
> >
> > The routine may be called like this:
> >
> > Dim rng as range
> > set rng = Rows(1).ChildRows.Select
> >
> > Is it possible to write a custom method for an existing object, or do I have
> > to write a similar class module (i.e. CRange) and then write the method?
> >
> > Thanks,
> > Matthew Pfluger

 
Reply With Quote
 
Matthew Pfluger
Guest
Posts: n/a
 
      8th Aug 2008
David,

I appreciate that, but I was referring to the Outline property. I apologize
for not making that clear. Excel provides the handy ability to group rows,
but they don't expose a lot of methods or properties for using this
functionality.

Thanks,
Matthew Pfluger

"David" wrote:

> Hi,
>
> I am in the cell that has a formula, then,
> Sub Macro1()
> Selection.ShowPrecedents
> Range(ActiveCell.Address).Precedents.Select
> z = Selection.Address
> MsgBox z
> End Sub
>
> Hope this helps.
> David
>
> "Matthew Pfluger" wrote:
>
> > Correction, I should have said CUSTOM RANGE PROPERTY, not method.
> >
> > "Matthew Pfluger" wrote:
> >
> > > I would like to write a custom method for the Range object that returns a
> > > Range object representing all child rows of the called row. I looked in the
> > > Object Browser, and I don't think such a method exists, but if somoeone knows
> > > differently, please tell me!
> > >
> > > The routine may be called like this:
> > >
> > > Dim rng as range
> > > set rng = Rows(1).ChildRows.Select
> > >
> > > Is it possible to write a custom method for an existing object, or do I have
> > > to write a similar class module (i.e. CRange) and then write the method?
> > >
> > > Thanks,
> > > Matthew Pfluger

 
Reply With Quote
 
David
Guest
Posts: n/a
 
      8th Aug 2008
Hi,

These are simple SubTotals or part of a pivot table? If it is SubTotals, I
think you can still use what was already provided, but if it is a pivot
table, then not.

David

"Matthew Pfluger" wrote:

> David,
>
> I appreciate that, but I was referring to the Outline property. I apologize
> for not making that clear. Excel provides the handy ability to group rows,
> but they don't expose a lot of methods or properties for using this
> functionality.
>
> Thanks,
> Matthew Pfluger
>
> "David" wrote:
>
> > Hi,
> >
> > I am in the cell that has a formula, then,
> > Sub Macro1()
> > Selection.ShowPrecedents
> > Range(ActiveCell.Address).Precedents.Select
> > z = Selection.Address
> > MsgBox z
> > End Sub
> >
> > Hope this helps.
> > David
> >
> > "Matthew Pfluger" wrote:
> >
> > > Correction, I should have said CUSTOM RANGE PROPERTY, not method.
> > >
> > > "Matthew Pfluger" wrote:
> > >
> > > > I would like to write a custom method for the Range object that returns a
> > > > Range object representing all child rows of the called row. I looked in the
> > > > Object Browser, and I don't think such a method exists, but if somoeone knows
> > > > differently, please tell me!
> > > >
> > > > The routine may be called like this:
> > > >
> > > > Dim rng as range
> > > > set rng = Rows(1).ChildRows.Select
> > > >
> > > > Is it possible to write a custom method for an existing object, or do I have
> > > > to write a similar class module (i.e. CRange) and then write the method?
> > > >
> > > > Thanks,
> > > > Matthew Pfluger

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"PasteSpecial method of Range class failed" when range Number of Rows > 2000 eskimo2 Microsoft Excel Programming 0 19th Oct 2007 06:09 PM
Custom attribute for a method: how to get the method object ? Oriane Microsoft Dot NET 1 12th Jun 2005 09:47 PM
Range Question / error 1004: method Range of object Worksheet has failed Paul Microsoft Excel Programming 3 7th Apr 2005 02:56 PM
Translate range name passed as string to a custom function to range addresses! agarwaldvk Microsoft Excel Programming 3 7th Sep 2004 12:47 PM
Adding named range gives error "method range of object _Global failed " Gunnar Johansson Microsoft Excel Programming 3 10th Aug 2004 01:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:36 AM.