Hello
First time posting on such a forum so apologies for any failure in etiquette. I have tried searching for a solution to this but am struggling. I get the above error when I run the following code:
Sub Update_Comments()
'
' Update_Comments Macro
' Permanent update to comments list
'
' Keyboard Shortcut: Ctrl+l
'
Range("A1").Select
ActiveSheet.Range("$O$38:$P$238").AutoFilter Field:=1, Criteria1:="0"
ActiveSheet.Range("$O$38:$P$238").AutoFilter Field:=2, Criteria1:="1"
Range("B40:B239").Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
ActiveSheet.Range("$S$38:$U$238").AutoFilter Field:=2
ActiveSheet.Range("$S$38:$U$238").AutoFilter Field:=1
ActiveSheet.Range("$S$38:$U$238").AutoFilter Field:=3, Criteria1:="1"
Range("Q39:Q" & Rows.Count).SpecialCells(xlVisible)(1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveSheet.Range("$S$38:$U$238").AutoFilter Field:=3
Range("A1").Select
End Sub
This code has been cobbled together from recording a macro and searching the web to try and achieve what I want to achieve which is:
Copy data from a range of visible cells once some filters have been applied, clear those filters and then apply a new filter for a new range, identify the first visible cell in the new range and paste the copied data in that column starting from the first visible cell in the filtered range (all other cells beneath the first visible cell are all visible).
Many thanks for any help
First time posting on such a forum so apologies for any failure in etiquette. I have tried searching for a solution to this but am struggling. I get the above error when I run the following code:
Sub Update_Comments()
'
' Update_Comments Macro
' Permanent update to comments list
'
' Keyboard Shortcut: Ctrl+l
'
Range("A1").Select
ActiveSheet.Range("$O$38:$P$238").AutoFilter Field:=1, Criteria1:="0"
ActiveSheet.Range("$O$38:$P$238").AutoFilter Field:=2, Criteria1:="1"
Range("B40:B239").Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
ActiveSheet.Range("$S$38:$U$238").AutoFilter Field:=2
ActiveSheet.Range("$S$38:$U$238").AutoFilter Field:=1
ActiveSheet.Range("$S$38:$U$238").AutoFilter Field:=3, Criteria1:="1"
Range("Q39:Q" & Rows.Count).SpecialCells(xlVisible)(1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveSheet.Range("$S$38:$U$238").AutoFilter Field:=3
Range("A1").Select
End Sub
This code has been cobbled together from recording a macro and searching the web to try and achieve what I want to achieve which is:
Copy data from a range of visible cells once some filters have been applied, clear those filters and then apply a new filter for a new range, identify the first visible cell in the new range and paste the copied data in that column starting from the first visible cell in the filtered range (all other cells beneath the first visible cell are all visible).
Many thanks for any help