dpaton05
Well-known Member
- Joined
- Aug 14, 2018
- Messages
- 2,362
- Office Version
- 365
- 2016
- Platform
- Windows
I have a button to add new lines to my table. The table has a date field in column A that is formatted to Australian date format. When I click the add new lines button, the new lines revert to US format for any dates that are entered in the new rows in column A. How can I force new, added rows to be Australian date formatting in column A?
Here is my add lines code.
Thanks for the help guys.
Here is my add lines code.
Code:
Sub Addlines()
Application.EnableEvents = False
'ActiveSheet.Unprotect Password:="npssadmin"
Dim ws As Worksheet, x As Long, tbl As ListObject, n As Long
On Error GoTo cancelled:
n = InputBox("How many lines would you like to add ?")
Set ws = ActiveSheet
Set tbl = ws.ListObjects("npss_quote")
'add 5 rows
For x = 1 To n
'add a row at the end of the table
tbl.ListRows.Add
ActiveSheet.ListObjects("npss_quote").DataBodyRange.Columns(13).Value = 1 - 0.1 * ActiveSheet.chkIncrease.Value
Next x
tbl.Range.Cells(tbl.ListRows.Count - n + 2, 1).Select
'ActiveSheet.Protect Password:="npssadmin"
Application.EnableEvents = True
cancelled:
Exit Sub
End Sub
Thanks for the help guys.