Hi. I'm trying to figure out if there's a better way to work this code. I want to copy certain data entries from one sheet into specific cells in another sheet. Right now, it works as long as there are less than 4 data entries to copy. I'd like to have it so that it works for more without having to add more If Not statements. My VBA knowledge is pretty limited, so any insight would be great!
VBA Code:
Sub CopyPasta()
Sheets("Copy").Select
Dim Fnd As Range, Cl As Range
Set Fnd = Range("1:1").Find("Notes", , , xlWhole, , , False, , False)
If Fnd Is Nothing Then
MsgBox "Notes Not Found"
Exit Sub
End If
For Each Cl In Range(Fnd, Cells(Rows.Count, Fnd.Column).End(xlUp))
If Cl.Value = "Flip" Then
ActiveCell.Select
Cl.Offset(0, -13).Range("A1").Select
Selection.Copy
Sheets("Paste").Select
Range("A2").Select
If Not IsEmpty(ActiveCell.Value) Then
ActiveCell.Offset(6, 0).Cells.Select
End If
If Not IsEmpty(ActiveCell.Value) Then
ActiveCell.Offset(6, 0).Cells.Select
End If
If Not IsEmpty(ActiveCell.Value) Then
ActiveCell.Offset(6, 0).Cells.Select
End If
ActiveSheet.Paste
Sheets("Copy").Select
ActiveCell.Offset(0, -1).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Paste").Select
Range("B2").Select
If Not IsEmpty(ActiveCell.Value) Then
ActiveCell.Offset(6, 0).Cells.Select
End If
If Not IsEmpty(ActiveCell.Value) Then
ActiveCell.Offset(6, 0).Cells.Select
End If
If Not IsEmpty(ActiveCell.Value) Then
ActiveCell.Offset(6, 0).Cells.Select
End If
ActiveSheet.Paste
Sheets("Paste").Select
Cells.Select
Selection.FormatConditions.Delete
Range("A2").Select
End If
Next Cl
End Sub