Private Sub CommandButton1_Click()
Dim InputFile As Workbook, OutputFile As Workbook
Dim Inputpath As String, Outputpath As String '
Dim lastRow As Long, rng As Range
'Dim lastRow As Long
'Dim rng As Range
Sheets("cotizacion").Select
Set rng = ActiveSheet.Cells
lastRow = rng.Find(What:="*", After:=rng.Cells(1), Lookat:=xlPart, LookIn:=xlFormulas, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False).Row + 1
Range("a" & lastRow).Select
ActiveCell.Offset(0, 11) = Tex20
ActiveCell.Offset(0, 12) = Combo10
ActiveCell.Offset(0, 13) = Combo20
ActiveCell.Offset(0, 14) = Combo30
ActiveCell.Offset(0, 15) = Tex12
ActiveCell.Offset(0, 16) = Tex13
ActiveCell.Offset(0, 17) = combo40
ActiveCell.Offset(0, 18) = Tex15
ActiveCell.Offset(0, 19) = Tex16
Sheets("Origen1").Select
lastRow = rng.Find(What:="*", After:=rng.Cells(1), Lookat:=xlPart, LookIn:=xlFormulas, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False).Row + 1
Range("a" & lastRow).Select
ActiveCell.Offset(0, 11) = Tex20
ActiveCell.Offset(0, 12) = Combo10
ActiveCell.Offset(0, 13) = Combo20
ActiveCell.Offset(0, 14) = Combo30
ActiveCell.Offset(0, 15) = Tex12
ActiveCell.Offset(0, 16) = Tex13
ActiveCell.Offset(0, 17) = combo40
ActiveCell.Offset(0, 18) = Tex15
ActiveCell.Offset(0, 19) = Tex16
'Set rng = ActiveSheet.Cells
'lastRow = rng.Find(What:="*", After:=rng.Cells(1), Lookat:=xlPart, LookIn:=xlFormulas, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False).Row + 1
'## Open both workbooks first:
Set InputFile = ActiveWorkbook
Set OutputFile = Workbooks.Open(ThisWorkbook.Path & "\LibroDestino.xlsm")
'Now, copy what you want from InputFile:
InputFile.Sheets("Origen1").Range("A2", Range("A2").End(xlToRight)).Select.Copy
'Range("a2", Range("a2").End(xlToRight)).Select
'Now, paste to OutputFile worksheet:
OutputFile.Sheets("destino").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteAll
'Close InputFile & OutputFile:
OutputFile.Close True
Range("A2", Range("A2").End(xlToRight)).Select
Selection.ClearContents
Unload ingresodatos
ingresodatos.Show
End Sub
Bookmarks