Home > Software engineering >  Want to create a new data update function in the excel
Want to create a new data update function in the excel

Time:10-23

I am a rookie of VBA, therefore to help you a great god, and
Is like that, I now have a DATABASE, and then want to build another sheet called DATA UPDATE, then allow users in DATA UPDATE the information is entered, then click a button, EXCEL automatically updates to the input with the next line of DATA in the sheet, so users don't have to UPDATE the DATA and turn to the last line of the DATA table manually income, so that can better protect the DATA,
Turn to the great god!

CodePudding user response:

Add a button on the DATAUPDATE, double-click the written code:
Private Sub CommandButton1_Click ()
DATA Sheets (" UPDATE "). Select
Range (" A2: E2). Select
Selection. Copy
Sheets (" DATABASE "). Select

Sheets (" DATABASE ") Cells (Sheets (" DATABASE "). UsedRange. Rows. Count + 1, 1). Select
ActiveSheet. Paste
DATA Sheets (" UPDATE "). Select
Range (" A3 "). Select
End Sub

CodePudding user response:

 Sub CommandButton1_Click () 
'to determine the next line of the DATABASE
Dim iR As Long
IR=Sheets (" DATABASE "). The Range (" a65536 "). The End (xlUp). Row + 1
"' copy data
Data Sheets (" update "). The Range (" a1: g1 "). Copy Sheets (" database ") Cells (iR, 1)
End Sub
  •  Tags:  
  • VBA
  • Related