Results 1 to 3 of 3

Userform to show some values on a sheet

This is a discussion on Userform to show some values on a sheet within the Excel Questions forums, part of the Question Forums category; I have a workbook consisting of 12 sheets. On every sheet there are some statistics in certain cells, always in ...

  1. #1
    New Member
    Join Date
    Mar 2002
    Location
    Schiphol Airport, Netherlands
    Posts
    48

    Default

    I have a workbook consisting of 12 sheets. On every sheet there are some statistics in certain cells, always in the same range (say column BE) but out of sight due to the size of the sheets. I would like to have a userform that shows these statistics by clicking a macrobutton. Each workbook sheet would get such a macro button and the userform should show the statistics of the particular sheet where the button was pressed. I know how to make a new userform but I can't figure out how to link the controls to the active worksheet. Any help would be appreciated.
    Thanks,
    Anthony

  2. #2
    New Member
    Join Date
    Nov 2002
    Posts
    8

    Default

    Hi Anthony

    you can get the name of the activesheet with this code :
    activesheet.name

    now make some public sub in a module that use this info, lets say :

    sub GetStatistics (SheetName As String)
    worksheet(SheetName).activate
    text1.text = activesheet.cells(1,58).value
    ' now you can get the values of the
    ' columns of the sheet where the button
    ' was pressed and show it on the form in
    ' textfield text1
    form.show
    end sub

    on the sheet you call this functions by
    call getstatistics(activesheet.name)

    greets

    koen

  3. #3
    Board Regular
    Join Date
    Nov 2002
    Posts
    83

    Default

    You don't say how you want to display the stats.

    On the form in a listbox? If so you can use the rowsource property BE:BE for the whole column, or BE1:BE20 if you know how many cells you need to include, which is better.

    You can also use a range in the list property, either can be set at runtime to count the number of cells in the column

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