Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / November 2006

Tip: Looking for answers? Try searching our database.

Excel Addin:Setting the range to the Excel.Range object range prop

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rp007 - 17 Nov 2006 13:09 GMT
Hi,

How do we set the entire Excel worksheet as a range to the Excel Range
object's range property?  I know we can set a particular column or from one
cell to another cell as a range to Excel Range object's range property but
how to set the entire worksheet as a range.

Any ideas, please share.

thanks in advance,
-Ram.
jlepack - 17 Nov 2006 13:47 GMT
If you mean all the cells in a worksheet and not the entire worksheet
itself then

public sub selectAllCells()
  dim r as range
  set r = cells
  r.select
end sub

but if you just want to select all the cells from the sheet to
copy/paste/delete/whatever then:

cells.select

is your best friend.

Cheers,
JAson Lepack

> Hi,
>
[quoted text clipped - 7 lines]
> thanks in advance,
> -Ram.
Rp007 - 21 Nov 2006 14:32 GMT
Hi,

thanks very much for the details... it solved the problem.  However it
raised one more query now setting up a particular column(entire column alone)
as a range to Range object's range property.  Has any clue.

thanks,
-Ram.

> If you mean all the cells in a worksheet and not the entire worksheet
> itself then
[quoted text clipped - 26 lines]
> > thanks in advance,
> > -Ram.
jlepack - 21 Nov 2006 15:30 GMT
Range("A:A").select will select the "A" column.

Range("2:2").select will select the "2" row.

Range("A1").select will select cell "A1".

Cheers,
Jason Lepack

> Hi,
>
[quoted text clipped - 35 lines]
> > > thanks in advance,
> > > -Ram.
Rp007 - 24 Nov 2006 14:24 GMT
Hi,

I tried it, but its not working.  Here I am using C# and trying to set
Excel's Range object as:
Excel rng = (Excel.Range)Excel.get_Range("Cell1", "Cell2");

Here get_Range method only accepts 2 arguments.  So couldn't able to set the
entire column selection.

Any ideas on the above, please share.

thanks,
-Ram.

> Range("A:A").select will select the "A" column.
>
[quoted text clipped - 44 lines]
> > > > thanks in advance,
> > > > -Ram.
jlepack - 24 Nov 2006 16:30 GMT
Ah, herein lies the problem.  I've been assuming you were using VBA.
You're actually using C#...

rng = (Excel.Range)Excel.get_range("A1", "A1")
rng = (Excel.Range)rng.entirecolumn

I think that might work.  I don't use C# with Excel so that's what my 5
minutes of research came up with.

Cheers,
Jason Lepack

Anyways...  If I'm not mistaken, get_range takes an input of two cells,
and if they're the same then it selects that cell, otherwise it selects
the range.
> Hi,
>
[quoted text clipped - 58 lines]
> > > > > thanks in advance,
> > > > > -Ram.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.