Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Reverse a function to return the array? | Excel Worksheet Functions | |||
Which Function to Use? Search an Array, Return a Row Value | Excel Discussion (Misc queries) | |||
Return array from worksheet function | Excel Worksheet Functions | |||
Return Array from Function | Excel Programming | |||
Return an array of values from a function | Excel Programming |