Hi All,
I am trying to copy a cell from 1 sheet and paste it in another sheet After pasting a template.
The problem is, I am using the paste after last row command but this mean that if I ever change the template dimensions, I would have to change the code.
So I am trying to solve this problem by defining what the last row is prior to pasting and then pasting to the next row, as opposed to finding the new last row, and then counting backwards, which was my original solution.
My code:
Any help is appreciated.
I am trying to copy a cell from 1 sheet and paste it in another sheet After pasting a template.
The problem is, I am using the paste after last row command but this mean that if I ever change the template dimensions, I would have to change the code.
So I am trying to solve this problem by defining what the last row is prior to pasting and then pasting to the next row, as opposed to finding the new last row, and then counting backwards, which was my original solution.
My code:
Code:
[COLOR=#0000ff]Sub[/COLOR] FindProj()
[COLOR=#0000ff]Dim[/COLOR] Lastrow As [COLOR=#0000ff]Long[/COLOR]
[COLOR=#0000ff]Dim[/COLOR] Newproj As [COLOR=#0000ff]Long[/COLOR]
Lastrow = Sheets("Historical").Cells(Rows.Count, "B").End(xlUp).Row
Newproj = Sheets("Data").Cells(Rows.Count, "A").End(xlUp).Offset(1)
AddProj [COLOR=#008000]'This copies the template and pastes it to the first empty row[/COLOR]
Sheets("Historical").Cells(Lastrow, "B").Copy Sheets("Data").Range(Newproj, "A")
[COLOR=#0000ff]End Sub[/COLOR]
Any help is appreciated.