Check Description VBA Code Available
Simple way to Learn Userform in Excel in Hindi
All VBA Code Step By Step
USERFORM CREATION
Userform1
CommandButton1 = Transfer Data
CommandButton2 = Reset Form
CommandButton3 = Quit
CommandButton4 = Search
CommandButton5 = Update
Textbox1 = ID
Textbox2=Name
Textbox3=Contact
Textbox4 = Search
VBA Code :
Private Sub CommandButton1_Click()
Dim x as Long
x= Sheet1.Range(“A”&Rows.Count).end(xlup).row+
sheet1.cells(x,1).value=textbox1.text
sheet1.cells(x,2).value=textbox2.text
sheet1.cells(x,3).value=textbox3.text
textbox1=””
textbox2=””
textbox3=””
MsgBox “Transfer Data Successfully”
End Sub
Private Sub CommandButton2_Click()
Unload Me
Userform1.Show
End Sub
Private Sub CommandButton3_Click()
Unload Me
End Sub
Private Sub CommandButton4_Click()
Dix x As Long
Dim y As Long
x=Sheet1.Range(“A” & Rows.Count).End(xlup).row
for y = 2 To x
if Sheet1.Cells(y, 1).Value=Textbox4.Text Then
Textbox1=Sheet1.Cells(y,1).Text
Textbox2=Sheet1.Cells(y,2).Text
Textbox3=Sheet1.Cells(y,3).Text
End if
Next y
End Sub
Private Sub CommandButton5_Click()
Dix x As Long
Dim y As Long
x=Sheet1.Range(“A” & Rows.Count).End(xlup).row
for y = 2 To x
if Sheet1.Cells(y, 1).Value=Textbox4.Text Then
Sheet1.Cells(y,1) =Textbox1.value
Sheet1.Cells(y,2) =Textbox2.value
Sheet1.Cells(y,3) =Textbox3.value
End if
Next y
MsgBox “Update Data Successfully”
End Sub
Create Macro for Show Form Button
UserForm1.Show
Please LiKE | SHARE | SUBSCRIBE
No comments:
Write comments