Calgary_Neil
Board Regular
- Joined
- Apr 5, 2014
- Messages
- 79
Hi Again , Two questions:
1) I'm using .Formula but am getting the Value. Really want to transfer the true state (ie =1 not 1)
2) I can not get a range to transfer. If I reduce the receiving part I get the first cell only. I would like to keep this simple and cut/paste feels long, but not impossible.
In the end this will loop X times offsetting from the starting column by 7.
Thanks for reading
Neil
Excel 365
1) I'm using .Formula but am getting the Value. Really want to transfer the true state (ie =1 not 1)
2) I can not get a range to transfer. If I reduce the receiving part I get the first cell only. I would like to keep this simple and cut/paste feels long, but not impossible.
In the end this will loop X times offsetting from the starting column by 7.
VBA Code:
Sub TransferData()
Dim NewWB As Workbook
Dim NewWS As Worksheet
Dim Folder As String
Dim OldWB As Workbook
Dim OldWS As Worksheet
Dim LTurn As Integer
'Pick New file
Set NewWB = ActiveWorkbook
Set NewWS = NewWB.Worksheets("Production")
'Pick Old File
Folder = "D:\Users\Owner\Documents\0) OneDrive\OneDrive\9) Unused\My Games\Space Empires\Current\WorkArea\"
Set OldWB = Workbooks.Open(Folder & "Gord9B_SE_4X_CE_V2.55.xlsm")
Set OldWS = OldWB.Worksheets("Production")
'Transfer Card Data
NewWB.Worksheets("Empire Cards").Range("B4:B36") = OldWB.Worksheets("Empire Cards").Range("B4:B36").Value
NewWB.Worksheets("Alien Cards").Range("B5:C36") = OldWB.Worksheets("Alien Cards").Range("B5:C36").Value
LTurn = 1
'Transfer K7
NewWS.Cells(7, 4 + LTurn * 7) = OldWS.Cells(7, 4 + LTurn * 7).Formula
'Transfer M7: M10
NewWS.Range(Cells(7, 6 + LTurn * 7), Cells(10, 6 + LTurn * 7)) = OldWS.Range(Cells(7, 6 + LTurn * 7), Cells(10, 6 + LTurn * 7)).Value
End Sub
Thanks for reading
Neil
Excel 365