Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Place rectangle and define its height?

I Have a rectangle I want to place at a location and set it's height.
To do that, I have "top" and "bottom" named ranges. Here are
specifications and what I tried:

'RAPP_REC_CASHFLOW = Rectangle name
'RAPP_TOP = Top of rectangle (= named range B2:G2)
'RAPP_BOTT = Bottom of rectangle (= named range B16:G16)

Tried with this, silly old me:-) :

Dim rng As Range
Set rng = Application.Union(Range("RAPP_TOP"), Range("RAPP_BOTT"))
Let ActiveSheet.Shapes("RAPP_REC_CASHFLOW").Top = Range("RAPP_TOP").Top
Let ActiveSheet.Shapes("RAPP_REC_CASHFLOW").Height = rng.Height

rng.Height make just one row of height ...
Any out there who can help?

kind regards
tskogstrom

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Place rectangle and define its height?

Dim rng As Range
Set rng = Application.Union(Range("RAPP_TOP"), Range("RAPP_BOTT"))
With ActiveSheet.Shapes("RAPP_REC_CASHFLOW")
.Top = rng.Top
.Height = Range("RAPP_BOTT").Top - Range("RAPP_TOP").Top
.Left = rng.Left
End With


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"tskogstrom" wrote in message
oups.com...
I Have a rectangle I want to place at a location and set it's height.
To do that, I have "top" and "bottom" named ranges. Here are
specifications and what I tried:

'RAPP_REC_CASHFLOW = Rectangle name
'RAPP_TOP = Top of rectangle (= named range B2:G2)
'RAPP_BOTT = Bottom of rectangle (= named range B16:G16)

Tried with this, silly old me:-) :

Dim rng As Range
Set rng = Application.Union(Range("RAPP_TOP"), Range("RAPP_BOTT"))
Let ActiveSheet.Shapes("RAPP_REC_CASHFLOW").Top = Range("RAPP_TOP").Top
Let ActiveSheet.Shapes("RAPP_REC_CASHFLOW").Height = rng.Height

rng.Height make just one row of height ...
Any out there who can help?

kind regards
tskogstrom



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Place rectangle and define its height?

Think you want to use Range instead of Union. See the difference between
these 2 values :

Dim rng As Range

Set rng = Union(Range("A1"), Range("C3"))
MsgBox rng.Height

Set rng = Range(Range("A1"), Range("C3"))
MsgBox rng.Height

NickHK
P.S. Whilst not wrong, use of "Let" is largely ignored nowadays, as it is
optional. "Set" is required though.

"tskogstrom" wrote in message
oups.com...
I Have a rectangle I want to place at a location and set it's height.
To do that, I have "top" and "bottom" named ranges. Here are
specifications and what I tried:

'RAPP_REC_CASHFLOW = Rectangle name
'RAPP_TOP = Top of rectangle (= named range B2:G2)
'RAPP_BOTT = Bottom of rectangle (= named range B16:G16)

Tried with this, silly old me:-) :

Dim rng As Range
Set rng = Application.Union(Range("RAPP_TOP"), Range("RAPP_BOTT"))
Let ActiveSheet.Shapes("RAPP_REC_CASHFLOW").Top = Range("RAPP_TOP").Top
Let ActiveSheet.Shapes("RAPP_REC_CASHFLOW").Height = rng.Height

rng.Height make just one row of height ...
Any out there who can help?

kind regards
tskogstrom



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Place rectangle and define its height?

You were right, Nick
It is Range(rage1, range2) method I tried to find.
Regards
tskogstrom


NickHK skrev:

Think you want to use Range instead of Union. See the difference between
these 2 values :

Dim rng As Range

Set rng = Union(Range("A1"), Range("C3"))
MsgBox rng.Height

Set rng = Range(Range("A1"), Range("C3"))
MsgBox rng.Height

NickHK
P.S. Whilst not wrong, use of "Let" is largely ignored nowadays, as it is
optional. "Set" is required though.

"tskogstrom" wrote in message
oups.com...
I Have a rectangle I want to place at a location and set it's height.
To do that, I have "top" and "bottom" named ranges. Here are
specifications and what I tried:

'RAPP_REC_CASHFLOW = Rectangle name
'RAPP_TOP = Top of rectangle (= named range B2:G2)
'RAPP_BOTT = Bottom of rectangle (= named range B16:G16)

Tried with this, silly old me:-) :

Dim rng As Range
Set rng = Application.Union(Range("RAPP_TOP"), Range("RAPP_BOTT"))
Let ActiveSheet.Shapes("RAPP_REC_CASHFLOW").Top = Range("RAPP_TOP").Top
Let ActiveSheet.Shapes("RAPP_REC_CASHFLOW").Height = rng.Height

rng.Height make just one row of height ...
Any out there who can help?

kind regards
tskogstrom


Reply
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
Set a minimum row height a the same time with autofit row height Julie B New Users to Excel 2 May 5th 23 07:44 PM
Row Height stopped growing and Auot-Fit Row Height does not work PSULionRP Excel Discussion (Misc queries) 0 May 19th 09 07:59 PM
Rectangle Box Keyrookie Excel Worksheet Functions 1 January 27th 08 08:09 AM
How to place a colored rectangle BEHIND some data cells? Big Greg. New Users to Excel 2 May 10th 07 11:04 AM
Resizing row height to dynamically fit height of text box Jon Excel Discussion (Misc queries) 1 August 8th 05 01:37 PM


All times are GMT +1. The time now is 04:38 AM.

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

About Us

"It's about Microsoft Excel"