PDA

View Full Version : [SOLVED:] VBA copy / paste to the next specific row



simora
12-27-2019, 08:22 PM
Happy Holidays Everyone:

What is the best way to organize a VBA copy / paste to the next available row after a specific cell

I want to copy an Entire row if the cell in Column A is in a list in My Range which I will define,
For example ActiveSheet.Range( "A5:A8")
and paste the entire row to the next available row after Row 80.
I have Specific rows already Populated with data. Rows 90 & 100 for example.
I will loop through a Range("A3:A50") to select what rows to copy based on if the cell in Column A is in the List that I have defined.
Eventually, I will paste another set of rows past row xx etc...etc...

SamT
12-28-2019, 12:13 PM
'
'Check if the cell in Column A is in a list
Acell.EntireRow.Copy PasteCell
'


Private Function PasteCell() As Range
If Range("A81") <> "" Then
Set PasteCel = Range("A80").End(xlDown)
Exit Function
Else
Set PasteCel = Range("A81")
End If
End Function

simora
12-29-2019, 12:53 PM
Thanks SamT:

You have pointed me in the right direction.