LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Set an Object

Well, if I understand what you are asking correctly, you could do the Set
operation this way...

Set = Range("M5").Resize(Cells(Rows.Count, "M").End(xlUp).Row - 4)

where the -4 comes from subtracting the start row of 5 and adding 1 because
we want the count of rows and not just the difference of rows.

--
Rick (MVP - Excel)


"JMay" wrote in message
...
Thanks Gary.

Are there other options in this case?

Jim

"Gary''s Student" wrote:

Almost the

Sub UseRangeObject2()
Set rng = Range("M5:M" & Cells(Rows.Count, "M").End(xlUp).Row)
MsgBox rng.Address
End Sub
--
Gary''s Student - gsnu200909


"JMay" wrote:

I'm familiar with setting an Object under UseRangeObject1() (first
below)

Sub UseRangeObject1()
Lr = Range("M" & Rows.Count).End(xlUp).Row
Set rng = Range("M5:M" & Lr)
End Sub

But can't one bypass getting the Lr as Follows? Currently no
working -
what is wrong with syntax?

Sub UseRangeObject2()
Set rng = Range("M5:M" & Rows.Count.End(xlUp).Row)
End Sub

TIA,

Jim




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Library invalid or contains references to object defintions John Excel Programming 1 July 24th 09 11:00 AM
2 Label Options - Forms Object vs Control Box Object Awrex Excel Discussion (Misc queries) 3 July 17th 09 07:10 PM
Can I get a chart object (excel.ChartObject) from OLE_chart.object chris Excel Programming 4 December 16th 08 08:36 AM
Option button object proeprties or object not found in vba Pete Straman S via OfficeKB.com Excel Programming 0 August 31st 05 05:49 PM
Confusion about how the Window object fits into the Excel object model Josh Sale Excel Programming 11 April 15th 05 06:08 PM


All times are GMT +1. The time now is 11:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"