hi all
I would like know if i want to set my syntax to record the value irregardless of worksheet name, is there anyway to do it? Currently I am able to specify a specific worksheet name as shown in the syntax below.
Dim ws As Worksheet
Set ws = Worksheets("budget tracking")
Dim newrow As Long
If Me.CBBudgetCode.ListIndex <> -1 And Len(Me.TxtBoxPurchaseDate.<wbr>Value) = 10 And Me.TxtBoxPORefNo.Value <> "" And Me.TxtBoxVendorName.Value <> "" And Me.TxtBoxQuantity.Value <> "" And Me.CBUnit.ListIndex <> -1 And Me.TxtBoxRate.Value <> "" And Me.CBLocation.ListIndex <> -1 And Me.TxtBoxTransctionDetails.<wbr>Value <> "" Then
newrow = Application.WorksheetFunction.<wbr>CountA(ws.Range("b:b")) + 2
ws.Cells(newrow, 2).Value = Me.CBBudgetCode.Value
ws.Cells(newrow, 3).Value = Me.TxtBoxPurchaseDate.Value
ws.Cells(newrow, 4).Value = Me.TxtBoxPORefNo.Value
ws.Cells(newrow, 5).Value = Me.TxtBoxVendorName.Value
ws.Cells(newrow, 6).Value = Me.TxtBoxItemPurchased.Value
ws.Cells(newrow, 7).Value = Me.TxtBoxQuantity.Value
ws.Cells(newrow, 8).Value = Me.CBUnit.Value
ws.Cells(newrow, 9).Value = Me.TxtBoxRate.Value
ws.Cells(newrow, 10).Value = Me.TxtAmount.Value
ws.Cells(newrow, 11).Value = Me.CBLocation.Value
ws.Cells(newrow, 12).Value = Me.TxtBoxTransctionDetails.<wbr>Value
End If
I would like know if i want to set my syntax to record the value irregardless of worksheet name, is there anyway to do it? Currently I am able to specify a specific worksheet name as shown in the syntax below.
Dim ws As Worksheet
Set ws = Worksheets("budget tracking")
Dim newrow As Long
If Me.CBBudgetCode.ListIndex <> -1 And Len(Me.TxtBoxPurchaseDate.<wbr>Value) = 10 And Me.TxtBoxPORefNo.Value <> "" And Me.TxtBoxVendorName.Value <> "" And Me.TxtBoxQuantity.Value <> "" And Me.CBUnit.ListIndex <> -1 And Me.TxtBoxRate.Value <> "" And Me.CBLocation.ListIndex <> -1 And Me.TxtBoxTransctionDetails.<wbr>Value <> "" Then
newrow = Application.WorksheetFunction.<wbr>CountA(ws.Range("b:b")) + 2
ws.Cells(newrow, 2).Value = Me.CBBudgetCode.Value
ws.Cells(newrow, 3).Value = Me.TxtBoxPurchaseDate.Value
ws.Cells(newrow, 4).Value = Me.TxtBoxPORefNo.Value
ws.Cells(newrow, 5).Value = Me.TxtBoxVendorName.Value
ws.Cells(newrow, 6).Value = Me.TxtBoxItemPurchased.Value
ws.Cells(newrow, 7).Value = Me.TxtBoxQuantity.Value
ws.Cells(newrow, 8).Value = Me.CBUnit.Value
ws.Cells(newrow, 9).Value = Me.TxtBoxRate.Value
ws.Cells(newrow, 10).Value = Me.TxtAmount.Value
ws.Cells(newrow, 11).Value = Me.CBLocation.Value
ws.Cells(newrow, 12).Value = Me.TxtBoxTransctionDetails.<wbr>Value
End If