Forum Discussion
BlueCollarVending
Nov 16, 2023Copper Contributor
[SOLVED] vba debug help
Hello all. So i have a form that i use to input information for inventory. Im having a issues on some of the inputs. Im needing help writing a code that will pop up a message box (instead of debug bo...
- Nov 16, 2023
Something like this:
Private Sub add_Click() If Len(Me.dateval)=0 Then Msgbox "Please enter a date!" Exit Sub End If If Not IsDate(Me.dateval) Then Msgbox "Please enter a valid date!" Exit Sub End If Set invoutws = ThisWorkbook.Sheets("Inventory In-Out") Set varws = ThisWorkbook.Sheets("VARIETY PACK") Set invmasterws = ThisWorkbook.Sheets("Inventory MASTER") nrowmaster = WorksheetFunction.CountA(invmasterws.Columns(2)) + 1 nrowvar = varws.Cells(varws.Rows.Count, 2).End(xlUp).Row nrows = WorksheetFunction.CountA(invoutws.Columns(1)) 'Cells(invoutws.Rows.Count, 1).End(xlUp).Row If Me.codeval <> "" Then invoutws.Range("A" & nrows + 1) = Me.codeval invoutws.Range("B" & nrows + 1) = Me.typeval invoutws.Range("C" & nrows + 1) = DateSerial(Year(Now), Split(Me.dateval, "-")(0), Split(Me.dateval, "-")(1)) invoutws.Range("D" & nrows + 1) = Me.qty * 1 = ""
JKPieterse
Nov 16, 2023Silver Contributor
Something like this:
Private Sub add_Click()
If Len(Me.dateval)=0 Then
Msgbox "Please enter a date!"
Exit Sub
End If
If Not IsDate(Me.dateval) Then
Msgbox "Please enter a valid date!"
Exit Sub
End If
Set invoutws = ThisWorkbook.Sheets("Inventory In-Out")
Set varws = ThisWorkbook.Sheets("VARIETY PACK")
Set invmasterws = ThisWorkbook.Sheets("Inventory MASTER")
nrowmaster = WorksheetFunction.CountA(invmasterws.Columns(2)) + 1
nrowvar = varws.Cells(varws.Rows.Count, 2).End(xlUp).Row
nrows = WorksheetFunction.CountA(invoutws.Columns(1)) 'Cells(invoutws.Rows.Count, 1).End(xlUp).Row
If Me.codeval <> "" Then
invoutws.Range("A" & nrows + 1) = Me.codeval
invoutws.Range("B" & nrows + 1) = Me.typeval
invoutws.Range("C" & nrows + 1) = DateSerial(Year(Now), Split(Me.dateval, "-")(0), Split(Me.dateval, "-")(1))
invoutws.Range("D" & nrows + 1) = Me.qty * 1 = ""BlueCollarVending
Nov 16, 2023Copper Contributor
Thank you