Good day,
I would appreciate any input in solving my problem. I have put together a simple calculator providing outputs in selected sheets. The Data goes beyond 6000 rows at times. I have been searching to solve this problem for the past 4 hours with different variation, but I like the idea of using filters, as this code will be repeated multiple times for different scenarios.
I have a button that needs to copy rows based on the value in cell AU. The cell value is "<0.29" that I am trying to filter by on a sheet named Calculations. The pasted row needs to populate the first available row in the sheet named Acceptable. I Keep getting a runtime error based on my code below. Also, is there a way to prevent duplication on this sheet and I would like to to skip values that are errors.
Thank you in advance.
I would appreciate any input in solving my problem. I have put together a simple calculator providing outputs in selected sheets. The Data goes beyond 6000 rows at times. I have been searching to solve this problem for the past 4 hours with different variation, but I like the idea of using filters, as this code will be repeated multiple times for different scenarios.
I have a button that needs to copy rows based on the value in cell AU. The cell value is "<0.29" that I am trying to filter by on a sheet named Calculations. The pasted row needs to populate the first available row in the sheet named Acceptable. I Keep getting a runtime error based on my code below. Also, is there a way to prevent duplication on this sheet and I would like to to skip values that are errors.
Thank you in advance.
Code:
Private Sub cb029_Click()
Worksheets("Calculations").Activate
lastrow = Cells(Rows.Count, 47).End(xlUp).Row
lastcol = Cells(1, Columns.Count).End(xlToLeft).Column
Application.ScreenUpdating = False
With ActiveSheet
.AutoFilterMode = False
.Range("A1", .Cells(lastrow, lastcol)).AutoFilter field:=47, Criteria1:="<0.29"
.Range("A1", .Cells(lastrow, lastcol)).SpecialCells(xlCellTypeVisible).Copy Acceptable.Range("A1")
.AutoFilterMode = False
End With
Application.ScreenUpdating = True
Unload Me
Worksheets("Acceptable").Activate
End Sub