How to display the content of an Excel sheet using VBA UserForm

Hello everyone

I am new to VBA programming, and I wanted to know if it is possible to display the contents of an Excel sheet in a userform. The user would only have to press a button to display (in a label) the data present on that sheet.

I’m not sure if this is possible, and I would like to know the VBA code associated with this button?

Thank you in advance.

If you need more details, feel free to ask me.

3 answers

  • Votes
  • Date
  • Descending date
  1. Hello,

    Yes, it is possible.
    Here is a course on userform.

    To display a cell value, you need to do it via a textbox:

    sub userform1_initialize

    textbox1 = range("A1")
    end sub

    https://www.excel-pratique.com/fr/vba/controles.php
    1. Yes, but with this method, I need to know the size of the data range in advance?
      Because my data changes and doesn't allow me to select only certain cells.

      I don't know if you see the problem?

      Thanks anyway for the info :)
    2. no, because you can use variables that allow you to adapt your form regardless of the number of lines and columns.
      Through code called VBA
    3. You're welcome :)