I want to mention the table name and table column
Private Sub cmdAdd_Click()
Dim cellrange As String
Dim rowno As Integer
Set ss = Data
Set ww = Application.WorksheetFunction
If comCategory.Text = "" Or txtSubCategory.Text = "" Then
Beep
MsgBox " Please input the data ", vbInformation, "Inventory Program"
Exit Sub
End If
Application.ScreenUpdating = False
Application.DisplayAlerts = False
With ss
If Me.comCategory = Data.Range("B7") Then
Data.Activate
Set rng = ActiveSheet.ListObjects("T_Food").Range
Dim lastrow As Long
lastrow = rng.Find(What:="*", _
After:=rng.Cells(1), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
''================================================================
'HERE I WANT TO KNOW IS THAT IS COORECT
fc = ww.CountIf(ss.Range("T_Food[[Sub Category]]"), Me.txtSubCategory.Text)
If fc >= 1 Then
amedia = MsgBox("This name already exist,Please choose other name ", vbCritical, "Inventory Program")
Exit Sub
End If
'AND HERE THE ONE I WANT TO MENTION TO TABLE NAME INSTEAD OF "D"
rng.Parent.Cells(lastrow + 1, "D").Value = Me.txtSubCategory.Text 'CODE
End If
Me.Label9.Visible = True
MsgBox " It has successfully added"
Me.comCategory = ""
Me.txtSubCategory = ""
End With
Application.ScreenUpdating = True
End Sub