M
Martin2
Hello to all.
¿how can I copy the last row (with data, obviously) in sheet1 in a
workbook named "first" in the first blank row of the sheet1 in another
workbook named "second"?
I try with this code but I am a beginner and my excel is an spanish
version. Doesn´t works:
Sub CopyIt()
Dim rngCopy As Range, rngDest As Range, wsName As String
With Worksheets("Sheet1")
Set rngCopy = .Range("A" & .Cells(Rows.Count, "A").End(xlUp).Row)
'the last row with data (by reference to column A)
wsName = .Range("B1").Value
'get destination sheet name from a given cell
End With
Set rngDest = Worksheets(wsName).Range("A1")
'always paste from A1
rngCopy.EntireRow.Copy Destination:=rngDest
'do the copy
End Sub
Thanks in advance.
Mart.
¿how can I copy the last row (with data, obviously) in sheet1 in a
workbook named "first" in the first blank row of the sheet1 in another
workbook named "second"?
I try with this code but I am a beginner and my excel is an spanish
version. Doesn´t works:
Sub CopyIt()
Dim rngCopy As Range, rngDest As Range, wsName As String
With Worksheets("Sheet1")
Set rngCopy = .Range("A" & .Cells(Rows.Count, "A").End(xlUp).Row)
'the last row with data (by reference to column A)
wsName = .Range("B1").Value
'get destination sheet name from a given cell
End With
Set rngDest = Worksheets(wsName).Range("A1")
'always paste from A1
rngCopy.EntireRow.Copy Destination:=rngDest
'do the copy
End Sub
Thanks in advance.
Mart.