Hi,
I have a routine that runs when a command button is pressed on a userform, this works fine, basically it will add the info from row 2 into the userform. The info in Row 2 comes from a series of Vlookups based upon the value in A1.
So basically if they click the command button "next" the routine does the following
Thereby changing the values of the text boxes in the UserFormCode:Range("A1").Select ActiveCell.Value=ActiveCell.Value +1 With Sheets("LookupTables") TextBox1.Text = .Range("LookupTables!A2").Value TextBox2.Text = .Range("LookupTables!B2").Value etc etc End With
However when i open this userform, triggered by a userform1.show command the boxes are empty and only fill after the user selects next of previous. I've played with copying the same "with" command into a PrivateSub Userform_initialize() but this doesn't seem to work. I'm wondering whether i'm putting that code in the wrong place? i've been putting it in a module? or is there another comman i should be using to trigger this?
Any help would be appreciated
Thanks
Ben
Sorry had a brainstorm and figured it out, you have to paste the Private Sub within the Userform Code, not a module.
Last edited: