Hi,
I have the following code to open connection to another workbook - copy a range and paste it to thisworkbook.
However, after paste and closing the connection, values/formulas from part of the range changed.
How could I prevent that aside from paste as values as I want to retain the formatting?
Thank you!
I have the following code to open connection to another workbook - copy a range and paste it to thisworkbook.
However, after paste and closing the connection, values/formulas from part of the range changed.
How could I prevent that aside from paste as values as I want to retain the formatting?
Thank you!
Code:
Sub import_Data(ByVal thisMonth As Integer, ByVal thisYear As Integer, ByVal thisDate As Date)
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
finalRow_Paste = ThisWorkbook.Worksheets("Sheet1").Cells(Sheets("Sheet1").Rows.Count, "a").End(xlUp).Row
Set rng_Paste = ThisWorkbook.Worksheets("Sheet1").Range("A" & finalRow_Paste + 2)
sessionDate = get_SessionDate(get_Minus_Day(), "Summary")
pathName = createPathName(get_Minus_Day(), "Summary") & "Summary " & sessionDate & ".xlsx"
Set wb = Application.Workbooks.Open(pathName)
finalRow_wb = wb.Worksheets("Summary").Cells(Sheets("Summary").Rows.Count, "F").End(xlUp).Row
Set wb_Copy = wb.Worksheets("Summary").Range("A1:F" & finalRow_wb)
wb_Copy.Copy Destination:=rng_Paste
Application.CutCopyMode = False
wb.Close False
pathName = ""