I am getting an error that says Method Range of Oject Global Failed. It refers to this line:
Any ideas why? Both start and EndW are declared and column c does have 1 and 9 in it. Thanks!
Code:
Range("A" & start & ":O" & EndW).Select
Code:
Dim EndW As Long
Dim start As Long
Dim nRowW As Long
Dim newrow As Long
'Data:
Sheets("Data").Activate
totalRows = Application.CountA(Range("F:F"))
'Figure out where the data starts:
For nRowW = 1 To totalRows
If Range("C" & nRowW).Value = 1 Then
start = nRowW
Exit For
End If
Next nRowW
'Figure out where the data ends:
For nRowW = start To totalRows
If Range("C" & nRowW).Value = 9 Then
EndW = nRowW - 1
Exit For
End If
Next nRowW
EndW = EndW
'Copy to new sheet:
Sheets.Add
ActiveSheet.Name = "WholeCycleData"
Sheets("Data").Select
Range("A" & start & ":O" & EndW).Select
Selection.Copy
Sheets("WholeCycleData").Select
Range("A1").Select
ActiveSheet.Paste