Copy the macro and function in a normal module
Alt F11
Insert module
Paste it in the module
Alt q to go back to Excel
This example copy row 1 from the sheet "Sheet1" to the first empty row on the worksheet "Sheet1"
You can run the macro with Alt-F8 or add a button on your sheet to run the macro
Sub copy_3_Values_PasteSpecial()
Dim sourceRange As Range
Dim destrange As Range
Dim Lr As Long
Application.ScreenUpdating = False
Lr = LastRow(Sheets("Sheet1")) + 1
Set sourceRange = Sheets("Sheet1").Rows("1:1")
Set destrange = Sheets("Sheet1").Rows(Lr)
sourceRange.Copy
destrange.PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function
--
Regards Ron de Bruinhttp://
www.rondebruin.nl/tips.htm
- Show quoted text -