jothan4859
New Member
- Joined
- Jan 31, 2022
- Messages
- 15
- Office Version
- 2016
- Platform
- Windows
Can anyone help me. I want to know how to add a code when i click submit button if the month is set to january the data will go to the January sheet or if the month is set to February the data will go to the february sheet.
Sub data_input()
ws_output = "JANUARY"
next_row = Sheets(ws_output).Range("A" & Rows.Count).End(xlUp).Offset(1).Row
Sheets(ws_output).Cells(next_row, 1).Value = Range("TIN").Value
Sheets(ws_output).Cells(next_row, 2).Value = Range("SUPPLIER").Value
Sheets(ws_output).Cells(next_row, 3).Value = Range("ADDRESS").Value
Sheets(ws_output).Cells(next_row, 4).Value = Range("AMOUNT").Value
Sheets(ws_output).Cells(next_row, 5).Value = Range("PURCHASE_MONTH").Value
Range("TIN").Value = ""
Range("SUPPLIER").Value = ""
Range("ADDRESS").Value = ""
Range("AMOUNT").Value = ""
Range("PURCHASE_DATE").Value = ""
End Sub
so far this is what i've done my mind is blowing how to make my submit button save the data in a specific sheet
Sub data_input()
ws_output = "JANUARY"
next_row = Sheets(ws_output).Range("A" & Rows.Count).End(xlUp).Offset(1).Row
Sheets(ws_output).Cells(next_row, 1).Value = Range("TIN").Value
Sheets(ws_output).Cells(next_row, 2).Value = Range("SUPPLIER").Value
Sheets(ws_output).Cells(next_row, 3).Value = Range("ADDRESS").Value
Sheets(ws_output).Cells(next_row, 4).Value = Range("AMOUNT").Value
Sheets(ws_output).Cells(next_row, 5).Value = Range("PURCHASE_MONTH").Value
Range("TIN").Value = ""
Range("SUPPLIER").Value = ""
Range("ADDRESS").Value = ""
Range("AMOUNT").Value = ""
Range("PURCHASE_DATE").Value = ""
End Sub
so far this is what i've done my mind is blowing how to make my submit button save the data in a specific sheet