I am importing a range of values from a one Workbook into another Workbook - Code looks like this
Dim targetSheet As Worksheet
Set targetSheet = targetWorkbook.Worksheets(1)
Dim sourceSheet As Worksheet
Set sourceSheet = customerWorkbook.Worksheets(1)
sourceSheet.Activate
targetSheet.Activate
targetSheet.Range("A2:A36").Value = sourceSheet.Range("A2:A36").Value
targetSheet.Range("C2:C36").Value = sourceSheet.Range("C2:C36").Value
targetSheet.Range("D2:D36").Value = sourceSheet.Range("D2:D36").Value
targetSheet.Range("E2:E36").Value = sourceSheet.Range("E2:E36").Value
targetSheet.Range("G2:G36").Value = sourceSheet.Range("G2:G36").Value
targetSheet.Range("H2:H36").Value = sourceSheet.Range("H2:H36").Value
targetSheet.Range("DA4:DA213").Value = sourceSheet.Range("DA4:DA213").Value
targetSheet.Range("DB4:DB213").Value = sourceSheet.Range("DB4:DB213").Value
Works fine until I get to
targetSheet.Range("DA4:DA213").Value = sourceSheet.Range("DA4:DA213").Value - where I get the 1004
Weird thing is - it actually does do the import for this line code before popping the debug
I googled this a bit and saw the suggestion to worksheet(activate) but that didnt change anything
Anyone?
Dim targetSheet As Worksheet
Set targetSheet = targetWorkbook.Worksheets(1)
Dim sourceSheet As Worksheet
Set sourceSheet = customerWorkbook.Worksheets(1)
sourceSheet.Activate
targetSheet.Activate
targetSheet.Range("A2:A36").Value = sourceSheet.Range("A2:A36").Value
targetSheet.Range("C2:C36").Value = sourceSheet.Range("C2:C36").Value
targetSheet.Range("D2:D36").Value = sourceSheet.Range("D2:D36").Value
targetSheet.Range("E2:E36").Value = sourceSheet.Range("E2:E36").Value
targetSheet.Range("G2:G36").Value = sourceSheet.Range("G2:G36").Value
targetSheet.Range("H2:H36").Value = sourceSheet.Range("H2:H36").Value
targetSheet.Range("DA4:DA213").Value = sourceSheet.Range("DA4:DA213").Value
targetSheet.Range("DB4:DB213").Value = sourceSheet.Range("DB4:DB213").Value
Works fine until I get to
targetSheet.Range("DA4:DA213").Value = sourceSheet.Range("DA4:DA213").Value - where I get the 1004
Weird thing is - it actually does do the import for this line code before popping the debug
I googled this a bit and saw the suggestion to worksheet(activate) but that didnt change anything
Anyone?