Moving Data From 1 WB to another

Calgary_Neil

Board Regular
Joined
Apr 5, 2014
Messages
79
I must be getting old, I can not see what VBA is complaining about. The error is "Compile error. Argument not optional" pointing at underlined range call.
VBA Code:
Sub ErrorTest()
    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")
'    For LTurn = 1 To OldWS.Range("A2").Value
LTurn = 1
'Transfer M8
        NewWS.Range.Cells(8, 6 + LTurn * 7) = _
            OldWS[U].Range[/U].Cells(8, 6 + LTurn * 7).Value    
End Sub

If there are better ways (cleaner, aster, efficient) please tell also
Thanks for looking
Neil
Excel 365
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
You must understand just reading VBA help !​
 
Upvote 0

Forum statistics

Threads
1,215,454
Messages
6,124,933
Members
449,195
Latest member
Stevenciu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top