VBA: Displaying cell values

  • I am trying to create a number viewer, the file is attached, what I wish to do is when the form is displayed for each of the txt boxes to display the figures contained in each cell within the range H1:K1. Then, if a person wishes to change a number they simply overtype the value shown in the txt box and click on an update button (which I have not added yet). The next row button when clicked on will move to the next row and display the next set of figures etc.


    I do not know how to make the txt boxes display values which are contained on the spreadsheet already.


    Can anyone suggest a solution?


    Thanks in advance

  • Private Sub UserForm_Initialize()
    txt1.Value = Range("H1").Value
    txt2.Value = Range("I1").Value
    txt3.Value = Range("J1").Value
    txt4.Value = Range("K1").Value
    End Sub


    This code will populate the Textboxes when the Userform is activated


    To update your sheet change the code to Range("H1").Value = txt1.Value, and so on Place it into a button's code

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!