Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42215

Method Range of Object Global failed

$
0
0
I am getting an error that says Method Range of Oject Global Failed. It refers to this line:
Code:

Range("A" & start & ":O" & EndW).Select
Any ideas why? Both start and EndW are declared and column c does have 1 and 9 in it. Thanks!

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


Viewing all articles
Browse latest Browse all 42215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>