macro calling a function
macro calling a function
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: macro calling a function

  1. #1
    Board Regular
    Join Date
    Apr 2002
    Posts
    237
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    I have the following function..
    =SUMIF(C:C,31,D:D)/COUNTIF(C:C,31)
    I need to call it from a macro and display results in a vb text box.

    TIA
    Jay

  2. #2
    MrExcel MVP Jay Petrulis's Avatar
    Join Date
    Mar 2002
    Location
    Chicago, IL USA
    Posts
    2,040
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    On 2002-04-04 15:54, JAYLO wrote:
    I have the following function..
    =SUMIF(C:C,31,D:D)/COUNTIF(C:C,31)
    I need to call it from a macro and display results in a vb text box.

    TIA
    Jay
    Hi JayLo,

    The following worked for me when placed in the userform initialize event

    --------------
    Private Sub UserForm_Initialize()

    With ThisWorkbook.Sheets("Sheet1")
    UserForm1.TextBox1.Value = Evaluate("=SUMIF(C:C,31,D:D)/COUNTIF(C:C,31)")
    End With

    End Sub
    --------------

    Modify to suit your workbook/sheets/range

    HTH,
    Jay

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com