D
davegb
Variable declared, set, so why is range failing?
Sub CopyCoVR2CtySht()
Dim wbSource As Workbook
Dim wsCoVR As Worksheet
Dim lMosColCount As Long
Dim lCtyRow As Long
Dim lColStart As Long
Dim wbCty As Workbook
Dim sCty As String
Set wbSource = ThisWorkbook
Set wsCoVR = wbSource.Sheets("CoVR_ModelImportDataBOS proj")
lColStart = 2
lCtyRow = 4
lMosColCount = 14
'start some kind of loop
sCty = wsCoVR.Range("A" & lCtyRow)
'MsgBox sCty
Workbooks.Add.Activate
Set wbCty = ActiveWorkbook
wbCty.SaveAs Filename:=ThisWorkbook.Path & "\" & sCty
wsCoVR.Range(Cells(lCtyRow, lColStart), Cells(lCtyRow, lColStart +
lMosColCount)).Copy <---RANGE FAILED
Any suggestions? Thanks!
Sub CopyCoVR2CtySht()
Dim wbSource As Workbook
Dim wsCoVR As Worksheet
Dim lMosColCount As Long
Dim lCtyRow As Long
Dim lColStart As Long
Dim wbCty As Workbook
Dim sCty As String
Set wbSource = ThisWorkbook
Set wsCoVR = wbSource.Sheets("CoVR_ModelImportDataBOS proj")
lColStart = 2
lCtyRow = 4
lMosColCount = 14
'start some kind of loop
sCty = wsCoVR.Range("A" & lCtyRow)
'MsgBox sCty
Workbooks.Add.Activate
Set wbCty = ActiveWorkbook
wbCty.SaveAs Filename:=ThisWorkbook.Path & "\" & sCty
wsCoVR.Range(Cells(lCtyRow, lColStart), Cells(lCtyRow, lColStart +
lMosColCount)).Copy <---RANGE FAILED
Any suggestions? Thanks!