I am trying to copy and past a selection into the first empty row of a database. I walked thru my code using F8 and it works right up to the very end where I have "Activesheet.Paste". Instead of pasting in the first empty row. It pastes over the previous data.
Code:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
'Place all data from userform1 to Tables
Sheets("Sheet2").Range("aa1").Value = UserForm1.ComboBox1.Value
Sheets("Sheet2").Range("ab1").Value = UserForm1.ComboBox2.Value
Sheets("Sheet2").Range("AC1").Value = UserForm1.ComboBox3.Value
Unload Me
Sheets("View").Select
Range("A4:P10000").Select
Selection.ClearContents
'Filter combobox 1
Sheets("Download").Select
Range("A1:O5000").Select
Selection.AutoFilter
If Sheets("Sheet2").Range("AA1").Value <> "" Then
Selection.AutoFilter Field:=1, Criteria1:=Sheets("Sheet2").Range("AA1").Value
Else
Selection.AutoFilter Field:=1
End If
'Copy and Paste Filter 1
Range("A1:P1000").Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("View").Select
Range("A3").Select
ActiveSheet.Paste
'Filter Combobox 2
Sheets("Download").Select
Range("A1:O5000").Select
Selection.AutoFilter
If Sheets("Sheet2").Range("AB1").Value <> "" Then
Selection.AutoFilter Field:=1, Criteria1:=Sheets("Sheet2").Range("AB1").Value
Else
Selection.AutoFilter Field:=1
End If
'Copy and Paste Filter 2
Range("A1:P1000").Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("View").Select
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("View")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub