Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default length of square

i have
Shapes("izensquare")
is there a way to have the length of "izensquare" in cell value A1
and length to be in B1?

thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default length of square

Add the following custom VBA functions into a module.

Function shapeh(ByVal shape_name As String)
shapeh = ActiveSheet.Shapes(shape_name).Height
End Function

Function shapew(ByVal shape_name As String)
shapew = ActiveSheet.Shapes(shape_name).Width
End Function


Then, in the cell which you want to return the height of the shape, type the
formula:
=shapeh("Rectangle 1")

For the width, type:
=shapew("Rectangle 1")


Regards,
Edwin Tam

http://www.vonixx.com


"choice" wrote:

i have
Shapes("izensquare")
is there a way to have the length of "izensquare" in cell value A1
and length to be in B1?

thanks in advance

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default length of square

do i need to run the function?
whenevery i run the sub, it doesnt change when the size of the object changes

"Edwin Tam" wrote:

Add the following custom VBA functions into a module.

Function shapeh(ByVal shape_name As String)
shapeh = ActiveSheet.Shapes(shape_name).Height
End Function

Function shapew(ByVal shape_name As String)
shapew = ActiveSheet.Shapes(shape_name).Width
End Function


Then, in the cell which you want to return the height of the shape, type the
formula:
=shapeh("Rectangle 1")

For the width, type:
=shapew("Rectangle 1")


Regards,
Edwin Tam

http://www.vonixx.com


"choice" wrote:

i have
Shapes("izensquare")
is there a way to have the length of "izensquare" in cell value A1
and length to be in B1?

thanks in advance

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default length of square

You can change the macros to:

Function shapeh(ByVal shape_name As String)
Application.Volatile
shapeh = ActiveSheet.Shapes(shape_name).Height
End Function

Function shapew(ByVal shape_name As String)
Application.Volatile
shapew = ActiveSheet.Shapes(shape_name).Width
End Function


When you adjust the shape, then press F9 to refresh the calculation of the
formulas.

Regads,
Edwin Tam

http://www.vonixx.com

"choice" wrote:

do i need to run the function?
whenevery i run the sub, it doesnt change when the size of the object changes

"Edwin Tam" wrote:

Add the following custom VBA functions into a module.

Function shapeh(ByVal shape_name As String)
shapeh = ActiveSheet.Shapes(shape_name).Height
End Function

Function shapew(ByVal shape_name As String)
shapew = ActiveSheet.Shapes(shape_name).Width
End Function


Then, in the cell which you want to return the height of the shape, type the
formula:
=shapeh("Rectangle 1")

For the width, type:
=shapew("Rectangle 1")


Regards,
Edwin Tam

http://www.vonixx.com


"choice" wrote:

i have
Shapes("izensquare")
is there a way to have the length of "izensquare" in cell value A1
and length to be in B1?

thanks in advance

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default length of square

Try something like


With ActiveSheet.Shapes("izensquare")
.Height = Range("A1").Value
.Width = Range("B1").Value
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"choice" wrote in message
...
i have
Shapes("izensquare")
is there a way to have the length of "izensquare" in cell value
A1
and length to be in B1?

thanks in advance



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
How do I a rotate my square radar chart (square-diamond)? Becs I Know Nathing Charts and Charting in Excel 5 April 3rd 23 07:30 PM
Length that falls within a length interval? Igorin Excel Worksheet Functions 4 November 20th 08 06:10 PM
how to center a square plot area in a square chart xppuser Charts and Charting in Excel 2 March 11th 06 08:13 AM
Regression Output -- R Square versus Adjusted R Square Bonnie Excel Discussion (Misc queries) 1 October 25th 05 12:55 AM
Shapes.. trying to print a square square keepitcool Excel Programming 3 November 21st 03 04:55 AM


All times are GMT +1. The time now is 11:36 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"