PDA

View Full Version : Using form to editing



KK1966
07-11-2008, 07:33 PM
Hi,

I have a code to using UserForm to edit the products rate and stores, which is too many products date rows down in to 500 form Col? A.

But the code?s somehow made a wrong field editing when I typed the products to looking edit,
Can u help to modify as attached the sample,

Your help many thank

Bob Phillips
07-12-2008, 02:10 AM
Private Sub cboName_Click()

With Sheets("Sheet1")

Me.txt1.Text = .Cells(Me.cboName.ListIndex + 2, "C")
Me.txt2.Text = .Cells(Me.cboName.ListIndex + 2, "D").Value
End With
End Sub

KK1966
07-12-2008, 08:04 AM
Dear XLD

That working well, but after I moving the button to another sheets, which can't work with the sheet1" data??

I want it activate in sheet5"

any idea?

Bob Phillips
07-12-2008, 08:09 AM
Maybe



Private Sub cboName_Click()

With ACtivesheet

Me.txt1.Text = .Cells(Me.cboName.ListIndex + 2, "C")
Me.txt2.Text = .Cells(Me.cboName.ListIndex + 2, "D").Value
End With
End Sub

KK1966
07-12-2008, 08:28 AM
XLD

Thank so much

mdmackillop
07-12-2008, 08:54 AM
Hi KK,
You mark a thread solved using the Thread Tools dropdown.
Regards
MD

KK1966
07-13-2008, 08:13 PM
hi

Someone can help me or tell me why the the code can’t Run when I activate it at the (Sheets5) to call the macros,
But, it back to the “Sheet1 “ that’s would be work ? I already set it “.With Sheets(“Sheet1”), why can’t to work at another work sheets?

Can explaining it to learn me more






Option Explicit
Private Sub cboName_Click()
Dim cells As Range
With Sheets("Sheet1")
Me.txt1.Text = .cells(Me.cboname.ListIndex + 2, "B")
Me.txt2.Text = .cells(Me.cboname.ListIndex + 2, "C").Value

End With

End Sub

Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub cmdOK_Click()
With Sheets("Sheet1")
.cells(Me.cboname.ListIndex + 2, "B").Value = Me.txt1.Text
.cells(Me.cboname.ListIndex + 2, "C").Value = Me.txt2.Text
End With


End Sub

Private Sub UserForm_Initialize()

With Sheets("Sheet1")
cboname.RowSource = "A2:A999"

Me.txt1.Text = .cells(Me.cboname.ListIndex + 2, "B").Value
Me.txt2.Text = .cells(Me.cboname.ListIndex + 2, "C").Value
End With

cboname.SetFocus

End Sub

mdmackillop
07-13-2008, 10:53 PM
Try

With Sheets("Sheet1")
cboname.RowSource = .Range("A2:A999")

KK1966
07-13-2008, 11:36 PM
Dear Md


Thanks your help, but seem that's remaing can't

:help

Bob Phillips
07-14-2008, 01:07 AM
Try



cboname.RowSource = .Range("A2:A99").Address(, , , True)

KK1966
07-14-2008, 01:23 AM
Dear XLd


Thanks Working well