How to make Textbox and CommandButton in Userform to transfer data is always displayed on the worksheet all the time?

Kenor

New Member
Joined
Dec 8, 2020
Messages
34
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

Anybody could help me?
How to make userform that i create to transfer data by insert the Row number in Textbox and click CommandButton is always displayed on the worksheet all the time?
 

Some videos you may like

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
3,856
See if this meets your needs ...

VBA Code:
Option Explicit
Private Sub btnCancel_Click()
    Unload Me
End Sub

Private Sub btnOK_Click()
    Dim ws As Worksheet
    Set ws = ActiveSheet
    Dim newRow As Long
    
    newRow = Application.WorksheetFunction.CountA(ws.Range("A:A")) + 1
    
    'The next two lines can be expanded as many times as needed for all the entry fields in your project
    
    ws.Cells(newRow, 1).Value = Me.txtFirstName.Value
    ws.Cells(newRow, 2).Value = Me.txtSurname.Value
    
End Sub
Sub CommandButton1_Click()
    Selection.EntireRow.Delete
End Sub

Download example workbook : Simple Database.xlsm
 

handri

New Member
Joined
Nov 25, 2017
Messages
46
See if this meets your needs ...

VBA Code:
Option Explicit
Private Sub btnCancel_Click()
    Unload Me
End Sub

Private Sub btnOK_Click()
    Dim ws As Worksheet
    Set ws = ActiveSheet
    Dim newRow As Long
   
    newRow = Application.WorksheetFunction.CountA(ws.Range("A:A")) + 1
   
    'The next two lines can be expanded as many times as needed for all the entry fields in your project
   
    ws.Cells(newRow, 1).Value = Me.txtFirstName.Value
    ws.Cells(newRow, 2).Value = Me.txtSurname.Value
   
End Sub
Sub CommandButton1_Click()
    Selection.EntireRow.Delete
End Sub

Download example workbook : Simple Database.xlsm
hi,

How do if i need to implement without ok button.

just enter than the data will capture in excel table.

thanks
 

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
3,856
Add the following to the UserForm code :

VBA Code:
Private Sub txtSurname_AfterUpdate()
    btnOK_Click
End Sub


Delete the OK button from the UserForm.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,976
Messages
5,599,143
Members
414,292
Latest member
kingshuk963

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top