Livin404
Well-known Member
- Joined
- Jan 7, 2019
- Messages
- 774
- Office Version
- 365
- 2019
- Platform
- Windows
Hello,
I've been working on a code to get my Database in Descending Order. The one I currently have actually works, but then I get my "Run-Time error '13'. From what I read it tells me the code does not recognise Column A beginning at A2 as a Date.
When I select the Debug it goes to a completely different Macro.
It highlights
For full context here is the full Macro. I do not want to change that because it works well for my other tasks I have.
Thank you,
I've been working on a code to get my Database in Descending Order. The one I currently have actually works, but then I get my "Run-Time error '13'. From what I read it tells me the code does not recognise Column A beginning at A2 as a Date.
VBA Code:
Private Sub CmdDescend_Click()
Dim xlSort As XlSortOrder
Dim LastRow As Long
With Sheets("ACTIVITY")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
.Range("A2") = "Date"
.Columns("A:F").Sort key1:=.Range("A2"), order1:=xlDescending, Header:=xlYes
Call Submit
Call RESET
End With
End Sub
When I select the Debug it goes to a completely different Macro.
It highlights
Excel Formula:
.Cells(iRow, 1).Value = CDate(frmForm.Txtdate)
For full context here is the full Macro. I do not want to change that because it works well for my other tasks I have.
VBA Code:
Sub Submit()
Dim sh As Worksheet
Dim iRow As Long
Set sh = ThisWorkbook.Sheets("Activity")
If frmForm.txtRowNumber.Value = "" Then
iRow = [Counta(Activity!A:A)] + 1
Else
iRow = frmForm.txtRowNumber.Value
End If
With sh
.Cells(iRow, 1).Value = CDate(frmForm.Txtdate)
.Cells(iRow, 2) = frmForm.Txtmission.Value
.Cells(iRow, 3) = frmForm.Cmbmode.Value
.Cells(iRow, 4) = frmForm.Cmbdenton_fms.Value
.Cells(iRow, 5) = frmForm.Txtweight.Value
End With
End Sub
Thank you,