LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Return Array from Function

I want to use the following subroutine as a function which will return array
aC. How would I declare it? Also, how would a sub then call the function
and display the results in a message box? TIA, James
Sub GetCoordsj()
Dim aC(1 To 4, 1 To 2) As Double
Dim bHflip As Boolean, bVflip As Boolean
Dim nBegin As Long, nEnd As Long
Dim shp As Shape

Set shp = ActiveSheet.Shapes(Selection.Name)
With shp
aC(1, 1) = .Left: aC(1, 2) = .Top
aC(2, 1) = .Left + .Width: aC(2, 2) = .Top
aC(3, 1) = .Left: aC(3, 2) = .Top + .Height
aC(4, 1) = .Left + .Width: aC(4, 2) = .Top + .Height

bHflip = .HorizontalFlip
bVflip = .VerticalFlip
End With

If bHflip = bVflip Then
If bVflip = False Then
'down to right
nBegin = 1: nEnd = 4
Else
'up to left
nBegin = 4: nEnd = 1
End If
ElseIf bHflip = False Then
'up to right
nBegin = 3: nEnd = 2
Else
'down to left
nBegin = 2: nEnd = 3
End If
' MsgBox "Begin X,Y " & aC(nBegin, 1) & ", " & aC(nBegin, 2) & Chr(13) _
' & "End X,Y " & aC(nEnd, 1) & ", " & aC(nEnd, 2)
End Sub



 
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
Reverse a function to return the array? bc4240 Excel Worksheet Functions 4 July 31st 09 05:25 AM
Which Function to Use? Search an Array, Return a Row Value [email protected] Excel Discussion (Misc queries) 1 August 24th 07 06:34 PM
Return array from worksheet function Steve Lloyd Excel Worksheet Functions 4 July 19th 06 06:15 PM
Return Array from Function [email protected] Excel Programming 2 January 10th 06 07:52 PM
Return an array of values from a function Raul Excel Programming 6 December 13th 04 07:33 PM


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