jeudi 4 juin 2020

how to make an if statement in excel where it checks if the cell is empty then it will not submit?

Sub data_input_rs()
'here I want to put an if statement that checks if the cell is empty or not

ws_output = "Rs"
next_row = Sheets(ws_output).Range("A" & Rows.Count).End(xlUp).Offset(1).Row
Sheets(ws_output).Cells(next_row, 1).Value = Range("date").Value
Sheets(ws_output).Cells(next_row, 2).Value = Range("name1").Value
Sheets(ws_output).Cells(next_row, 3).Value = Range("rs_number").Value
Sheets(ws_output).Cells(next_row, 4).Value = Range("amount1").Value

'here I want to put an if statement that checks if the cell is empty or not   
next_row = Sheets(ws_output).Range("A" & Rows.Count).End(xlUp).Offset(1).Row
Sheets(ws_output).Cells(next_row, 1).Value = Range("date").Value
Sheets(ws_output).Cells(next_row, 2).Value = Range("name2").Value
Sheets(ws_output).Cells(next_row, 3).Value = Range("rs_number").Value
Sheets(ws_output).Cells(next_row, 4).Value = Range("amount2").Value

End Sub

Aucun commentaire:

Enregistrer un commentaire