I'm having trouble getting my button to paste certain rows into a certain sheet if a string is entered into a textbox.
What I have is a userform that I'd like to paste entries into Month specific sheets based on the date textbox. I can get it to copy to one specific sheet no problem, but I'd like it to auto sort into the appropriate Month sheet based on the value entered in DT.value
Private Sub Submit_Click()
Dim ws As Worksheet
Dim LastRow As Long
If DT.Value = "nov" Then
Set ws = ThisWorkbook.Worksheets("NOV")
Else
If DT.Value = "dec" Then
Set ws = ThisWorkbook.Worksheets("DEC")
Else
If DT.Value = "Jan" Then
Set ws = ThisWorkbook.Worksheets("JAN")
Else
If DT.Value = "Feb" Then
Set ws = ThisWorkbook.Worksheets("FEB")
Else
If DT.Value = "mar" Then
Set ws = ThisWorkbook.Worksheets("MAR")
Else
If DT.Value = "Apr" Then
Set ws = ThisWorkbook.Worksheets("APR")
LastRow = ws.Range("A"& Rows.Count).End(xlUp).Row + 1
'other code that works just fine below.
With this code I keep ending up with Type Mismatch or just nothing gets copied over.
I'd like to be able to have the user enter a date in the dt.value box and have all the data paste to the appropriate sheet based on that value.