I have 3 functions that I use to detect when a new row is added on a Sheet5, go to Sheet1 and add a copy of a predefined range to the last row on sheet1.
My problem is I then want to have a particular cell on that new row from Sheet5 to be copied to a particular cell the newly pasted Sheet1 range.
I have a function that definitely finds a cell on one sheet and pastes it on another sheet. I just need a way to have it find the cell in the newly created row and then paste it in the newly created template.
My code for copying and pasting the cell:
Sub CopyCell()
Sheet5.Select
Range("B64").Select
Selection.Copy
Sheet1.Select
Range("C1962").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End Sub
The rest of my code:
Sub Worksheet_Calculate()
Dim X As Range
Set X = LastCell
If Sheet5.Range("A" & Rows.Count).Value < X.Value Then
X.Value = Me.Range("A" & Rows.Count).Value
AddProj
End If
End Sub
Function LastCell() As Range
With Sheet5
Set LastCell = .Cells(Rows.Count, 1).End(xlUp)
End With
End Function
Sub AddProj()
Sheet1.Range("Master").Copy Sheet1.Range("C" & Rows.Count).End(xlUp).Offset(1)
End Sub
Can I simply modify the LastCell and Worksheet_Calculate functions and place them on Sheet1?
This way I can calculate the last row prior to anything being added and then offset 1 and paste?
Any help?
My problem is I then want to have a particular cell on that new row from Sheet5 to be copied to a particular cell the newly pasted Sheet1 range.
I have a function that definitely finds a cell on one sheet and pastes it on another sheet. I just need a way to have it find the cell in the newly created row and then paste it in the newly created template.
My code for copying and pasting the cell:
Sub CopyCell()
Sheet5.Select
Range("B64").Select
Selection.Copy
Sheet1.Select
Range("C1962").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End Sub
The rest of my code:
Sub Worksheet_Calculate()
Dim X As Range
Set X = LastCell
If Sheet5.Range("A" & Rows.Count).Value < X.Value Then
X.Value = Me.Range("A" & Rows.Count).Value
AddProj
End If
End Sub
Function LastCell() As Range
With Sheet5
Set LastCell = .Cells(Rows.Count, 1).End(xlUp)
End With
End Function
Sub AddProj()
Sheet1.Range("Master").Copy Sheet1.Range("C" & Rows.Count).End(xlUp).Offset(1)
End Sub
Can I simply modify the LastCell and Worksheet_Calculate functions and place them on Sheet1?
This way I can calculate the last row prior to anything being added and then offset 1 and paste?
Any help?
Last edited: