I am trying to copy and paste all cell values in column A ABOVE specific cell value “QUESION”. I tried the below code which copies all cell values BELOW the cell value “QUESTION”. I could not figure out how to copy the cell values above. Any help will be much appreciated.
Sub CopyBelowData()
Dim strSearch As String
Dim fVal As Range
Dim lLastRow As Long
Dim strSel As String
'Set the value you want to search
strSearch = "*Question*"
'Find string on column A
Set fVal = Sheets("Sheet1").Columns("A:A").Find(strSearch, LookIn:=xlValues, lookat:=xlWhole)
If fVal Is Nothing Then
'Not Found - end
MsgBox "Search returned no matches."
GoTo LastLine
End If
'Find last used row
lLastRow = Sheets("Sheet1").Range("A:A").Cells(Rows.count, 1).End(xlUp).Row
strSel = fVal.Address & ":$A$" & lLastRow
MsgBox "Moving Answer Keys: " & strSel
'Copy and Paste the Answer Key
Sheets("Sheet1").Range(strSel).Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("A1").PasteSpecial xlPasteValues
Columns("A:A").HorizontalAlignment = xlLeft
Application.CutCopyMode = False
LastLine:
End Sub