VBA: delete specific cells before pasting data

Viewed 118

i'm making a data input in sheet1, copies the two first rows with data (not the header) and then paste it in sheet2. But i only need data from column S to AJ. From column A to E is some URL lines and they keep getting copied and pasted with the data i need.

So is there a way to delete or fold in some specific cells/rows/columns before pasting the data i need? So like delete these cells and then paste the data in column A in sheet2, now the data gets pushed to column D in sheet2.

Hope there is someone that can help me without seeing the code, as it is for work and can't get shown:(

1 Answers

I think you should try like this:

Option Explicit
Sub main()
Dim w As Workbook
Dim s1 As Worksheet
Dim s2 As Worksheet
Set w = ActiveWorkbook
Set s1 = w.Sheets(1)
Set s2 = w.Sheets(2)
    s1.Range(Cells(2, 19), Cells(s1.UsedRange.Rows.Count, 36)).Copy Destination:=s2.Range(s2.Cells(2, 1), s2.Cells(CInt(s1.UsedRange.Rows.Count), 18))
End Sub
Related