mdmorgan
04-30-2010, 10:21 PM
Hi,
I am in need of assistance. I have a Userform named "Wellinfo". On this form I have 10 Textboxes that a user can type information into, then whent hey click okay it populates the corisponding cells in the worksheet.
The problem I am having is that I need the textboxes to pull the information back from the cells when the userform is opened a second time. The userform opens up just fine but the textboxes do not grab the information from cells. However the information goes to them just fine by writing a simple code like this:
Private Sub cmdOK_Click()
Dim ws As Worksheet
Set ws = Worksheets("Well Information")
ws.Cells.range("I3").Value = wellnumber.Text
ws.Cells.range("I4").Value = billingnumber.Text
ws.Cells.range("I5").Value = fieldname.Text
ws.Cells.range("I6").Value = county.Text
ws.Cells.range("I7").Value = state.Text
ws.Cells.range("I9").Value = basemeridian.Text
ws.Cells.range("I11").Value = spuddate.Text
ws.Cells.range("C3").Value = operator.Text
ws.Cells.range("c4").Value = operatorrep1.Text
ws.Cells.range("c5").Value = operatorrep2.Text
ws.Cells.range("c13").Value = rignumber.Text
ws.Cells.range("C14").Value = rigrep1.Text
ws.Cells.range("c15").Value = rigrep2.Text
ws.Cells.range("I8").Value = section & "/" & township & "/" & range
Unload Me
End Sub
What code do I need to use to have the userform pull the information back out of the cells and populate their textboxes in the userform. Any help would be greatly appreciated! Having trouble finding the answer elsewhere!
I am in need of assistance. I have a Userform named "Wellinfo". On this form I have 10 Textboxes that a user can type information into, then whent hey click okay it populates the corisponding cells in the worksheet.
The problem I am having is that I need the textboxes to pull the information back from the cells when the userform is opened a second time. The userform opens up just fine but the textboxes do not grab the information from cells. However the information goes to them just fine by writing a simple code like this:
Private Sub cmdOK_Click()
Dim ws As Worksheet
Set ws = Worksheets("Well Information")
ws.Cells.range("I3").Value = wellnumber.Text
ws.Cells.range("I4").Value = billingnumber.Text
ws.Cells.range("I5").Value = fieldname.Text
ws.Cells.range("I6").Value = county.Text
ws.Cells.range("I7").Value = state.Text
ws.Cells.range("I9").Value = basemeridian.Text
ws.Cells.range("I11").Value = spuddate.Text
ws.Cells.range("C3").Value = operator.Text
ws.Cells.range("c4").Value = operatorrep1.Text
ws.Cells.range("c5").Value = operatorrep2.Text
ws.Cells.range("c13").Value = rignumber.Text
ws.Cells.range("C14").Value = rigrep1.Text
ws.Cells.range("c15").Value = rigrep2.Text
ws.Cells.range("I8").Value = section & "/" & township & "/" & range
Unload Me
End Sub
What code do I need to use to have the userform pull the information back out of the cells and populate their textboxes in the userform. Any help would be greatly appreciated! Having trouble finding the answer elsewhere!