paleaux
08-12-2011, 11:01 AM
I am getting an error when I run my code
Error 9 Subscript out of Range..
Normally this would be due to the fact the worksheets in question are not named, but all of my worksheets are named.
Code:
Sub Test()
Worksheets("Gate_Log").Range("A2:B300").Copy Worksheets("Timesheet").Range("B2")
Worksheets("Gate_Log").Range("D2:D300").Copy Worksheets("Timesheet").Range("D2")
Worksheets("Gate_Log").Range("E2:E300").Copy Worksheets("Timesheet").Range("N2")
Worksheets("Gate_Log").Range("A2:A300").Copy Worksheets("Material").Range("A2")
Worksheets("Gate_Log").Range("D2:D300").Copy Worksheets("Material").Range("B2")
Worksheets("Gate_Log").Range("A2:A300").Copy Worksheets("Equipment").Range("A2")
Worksheets("Gate_Log").Range("D2:D300").Copy Worksheets("Equipment").Range("B2")
Worksheets("Gate_Log").Range("A2:A300").Copy Worksheets("ThirdParty").Range("A2")
Worksheets("Gate_Log").Range("D2:D300").Copy Worksheets("ThirdParty").Range("B2")
Dim OneCell As Range
For Each OneCell In Range(Range("N2"), Range("N" & Rows.Count).End(xlUp))
OneCell.Formula = "=Round(" & OneCell.Value & ",0)"
Next OneCell
End Sub
Can anyone give me a hand with this, Thanks...
Error 9 Subscript out of Range..
Normally this would be due to the fact the worksheets in question are not named, but all of my worksheets are named.
Code:
Sub Test()
Worksheets("Gate_Log").Range("A2:B300").Copy Worksheets("Timesheet").Range("B2")
Worksheets("Gate_Log").Range("D2:D300").Copy Worksheets("Timesheet").Range("D2")
Worksheets("Gate_Log").Range("E2:E300").Copy Worksheets("Timesheet").Range("N2")
Worksheets("Gate_Log").Range("A2:A300").Copy Worksheets("Material").Range("A2")
Worksheets("Gate_Log").Range("D2:D300").Copy Worksheets("Material").Range("B2")
Worksheets("Gate_Log").Range("A2:A300").Copy Worksheets("Equipment").Range("A2")
Worksheets("Gate_Log").Range("D2:D300").Copy Worksheets("Equipment").Range("B2")
Worksheets("Gate_Log").Range("A2:A300").Copy Worksheets("ThirdParty").Range("A2")
Worksheets("Gate_Log").Range("D2:D300").Copy Worksheets("ThirdParty").Range("B2")
Dim OneCell As Range
For Each OneCell In Range(Range("N2"), Range("N" & Rows.Count).End(xlUp))
OneCell.Formula = "=Round(" & OneCell.Value & ",0)"
Next OneCell
End Sub
Can anyone give me a hand with this, Thanks...