Katolux182
New Member
- Joined
- Oct 27, 2023
- Messages
- 7
- Office Version
- 365
Hi,
I am new into de forum and kind of new into VBA. I have written this code(with some support of youtube videos etc) to copy a specific Sheet from one worksheet to another.
This code works, although I guess you guys have a better way of writting it. My issue is that I would like to copy specific cells from this worksheet and I am not being able to make it work.
I have tried looping it looking for the header, doing
, or include the rng for the specific cells but I am not being able integrate it into the code instead of
that is copying the whole sheet/tab. The cells would be E, F ,J ,I ,K ,L.
As I am asking for help, I will like to know if someone can also share some knowledge with me. I will like to only copy the new information that is not already in the "y" location of the program
My idea is to integrate this into a bottom, so once clicked and accepted, information for a Master Sheet can be copied into my "program"
Thank you for any help you guys can give me. I feel like a dinosaur
I am new into de forum and kind of new into VBA. I have written this code(with some support of youtube videos etc) to copy a specific Sheet from one worksheet to another.
VBA Code:
Sub CopytoWorkbook()
Dim x As Workbook, y As Workbook
Dim ws1 As Worksheet, ws2 As Worksheet
Dim LastRow As Long
Dim rngToCopy As Range
Dim NewEnd As Long
Dim NewEnd2 As Long
Set x = Workbooks.Open("C:\Users\agmzj\OneDrive\Escritorio\2023-08-28_Seriennummern_KOPIE.xlsx") 'Direction of database
Set y = Workbooks.Open("C:\Users\agmzj\OneDrive\Escritorio\Control Program.xlsm") 'Direction of program
Set ws1 = x.Sheets("Schlägerübersicht")
Set ws2 = y.Sheets("Master sheet")
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
ws1.Cells.Copy ws2.Cells
x.Close
End Sub
This code works, although I guess you guys have a better way of writting it. My issue is that I would like to copy specific cells from this worksheet and I am not being able to make it work.
I have tried looping it looking for the header, doing
Code:
.copy
VBA Code:
ws1.Cells.Copy ws2.Cells
As I am asking for help, I will like to know if someone can also share some knowledge with me. I will like to only copy the new information that is not already in the "y" location of the program
My idea is to integrate this into a bottom, so once clicked and accepted, information for a Master Sheet can be copied into my "program"
Thank you for any help you guys can give me. I feel like a dinosaur