function double output

  • Thread starter Thread starter matthijsdezwart
  • Start date Start date
M

matthijsdezwart

hi,

I cannot remember how it is called and therefore I cannot seem to find
an example on the internet.

maybe one of you can give me a hand.
I would like to make a function that has an output of two results.

for instance:
I select cells A1 and B1 type =testfunction() and then hit
CRTL_SHIFT_ENTER

then I would like to write output to A1 and other output to b1.
How can I do that?
regards,

Matthijs
 
Matthijs,

Select A1:B1, type =testfunction() and press Ctrl-Shift-Enter.

HTH,
Bernie
MS Excel MVP


Function testfunction()
Dim Arr(1 To 2) As Variant
Arr(1) = "Test"
Arr(2) = 3.14
If Application.Caller.Rows.Count = 1 Then
testfunction = Arr
Else
testfunction = Application.Transpose(Arr)
End If

End Function
 
thanks!!

Matthijs,

Select A1:B1, type =testfunction() and press Ctrl-Shift-Enter.

HTH,
Bernie
MS Excel MVP

Function testfunction()
Dim Arr(1 To 2) As Variant
Arr(1) = "Test"
Arr(2) = 3.14
If Application.Caller.Rows.Count = 1 Then
    testfunction = Arr
Else
    testfunction = Application.Transpose(Arr)
End If

End Function











- Tekst uit oorspronkelijk bericht weergeven -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top