Hi!
I have an issue with my new workbook.
I'd like to copy data from my active workbook to another one, which is closed.
I have half success.
The sheet stands from two parts. An info part and a table. I can copy all the data from the info part but not the table.
I use the range method to copy single cells. But I cannot do the same with a range.
I need to set the range variables but I don't know how...
Can somebody compliment or convert my code to a working one?
Thank you.
I use this code to the table:
I have an issue with my new workbook.
I'd like to copy data from my active workbook to another one, which is closed.
I have half success.
The sheet stands from two parts. An info part and a table. I can copy all the data from the info part but not the table.
I use the range method to copy single cells. But I cannot do the same with a range.
I need to set the range variables but I don't know how...
Can somebody compliment or convert my code to a working one?
Thank you.
I use this code to the table:
Code:
Sub SaveDim()
Dim M1 As Range
Dim M2 As Range
Dim M3 As Range
Dim M4 As Range
Dim M5 As Range
Dim M6 As Range
Dim M7 As Range
Dim M8 As Range
Dim ID As Range
Dim mydata As Workbook
Worksheets("Data").Select
M1 = Range("B4:B54")
Worksheets("Data").Select
M2 = Range("C4:C54")
Worksheets("Data").Select
M3 = Range("D4:D54")
Worksheets("Data").Select
M4 = Range("E4:E54")
Worksheets("Data").Select
M5 = Range("F4:F54")
Worksheets("Data").Select
M6 = Range("G4:G54")
Worksheets("Data").Select
M7 = Range("H4:H54")
Worksheets("Data").Select
M8 = Range("I4:I54")
Worksheets("Data").Select
ID = Range("J4:J54")
Set mydata = Workbooks.Open("Path and name")
Worksheets("Sheet1").Select
Worksheets("Sheet1").Range("A1").Select
RowCount = Worksheets("Sheet1").Range("A1").CurrentRegion.Rows.Count
With Worksheets("Sheet1").Range("A1")
.Offset(RowCount, 0) = M1
.Offset(RowCount, 1) = M2
.Offset(RowCount, 2) = M3
.Offset(RowCount, 3) = M4
.Offset(RowCount, 4) = M5
.Offset(RowCount, 5) = M6
.Offset(RowCount, 6) = M7
.Offset(RowCount, 7) = M8
.Offset(RowCount, 8) = ID
End With
mydata.Save
mydata.Close
End Sub