Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel VB macro getting runtime error '9': Subscript out of range - Help please ! 1

Status
Not open for further replies.

NWildblood

Technical User
Nov 12, 2007
113
GB
Hi, sorry this should be quite straightforward but I cannot crack it - any help gratefully received !

When running the code below in a workbook, I am getting the error "runtime error '9': Subscript out of range"

At the point indicated [highlight #FCE94F]below[/highlight] [highlight #FCE94F][/highlight]- when i am shifting between work-sheets

Any assistance kindly welcomed !

Thank you

OOS

__________________________________________
Sub Risk_Milestones_3()
'
' Risk_Milestones_3 Macro
'

'
Sheets("Risk Log").Select
Columns("B:B").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Cells.Select
With Selection
.VerticalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A1").Select
[highlight #FCE94F] Sheets("Milestones & Plan ").Select[/highlight]
Columns("A:A").ColumnWidth = 6.86
Columns("B:B").Select
Range("B4").Activate
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("D:D").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("B:B").Select
Selection.ColumnWidth = 21.71
Columns("E:E").Select
Selection.Delete Shift:=xlToLeft
Columns("E:E").Select
Range("E4").Activate
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("D4").Select
ActiveCell.FormulaR1C1 = "m"
Range("D4").Select
ActiveCell.FormulaR1C1 = "=+m_"
Range("D4").Select
ActiveCell.FormulaR1C1 = "_m_"
Range("D4").Select
Selection.Copy
Range("D4:D103").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("M4").Select
Columns("C:C").ColumnWidth = 24
Columns("B:B").ColumnWidth = 33.57
Range("B4").Select
Sheets("Risk Log ").Select
ActiveWindow.SmallScroll Down:=-9
Sheets("Project Overview").Select
ActiveWindow.SmallScroll Down:=-9
Range("C7").Select
Selection.Copy
Sheets("Risk Log ").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Columns("A:A").ColumnWidth = 37.14
Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Range("A1:A66").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWindow.SmallScroll Down:=-21
Columns("B:B").ColumnWidth = 30.71
Columns("C:C").ColumnWidth = 34.43
Range("C7").Select
ActiveCell.FormulaR1C1 = "_R_"
Range("B7").Select
ActiveCell.FormulaR1C1 = "=CONCATENATE(RC[-1],RC[1],RC[2])"
Selection.Copy
Range("B7:B66").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Columns("B:B").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Project Overview").Select
ActiveWindow.SmallScroll Down:=-6
Range("C7").Select
Selection.Copy
Sheets("Milestones & Plan ").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.Copy
Range("B4:B103").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWindow.SmallScroll Down:=-111
Range("C4").Select
ActiveCell.FormulaR1C1 = "=CONCATENATE(RC[-1],RC[1],RC[2])"
Selection.Copy
Range("C4:C103").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWindow.SmallScroll Down:=-123
Columns("C:C").ColumnWidth = 33.29
Columns("C:C").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub


"No-one got everything done by Friday except Robinson Crusoe...
 
Seems like you don't have a sheet named "Milestones & Plan " in the active workbook.
Did you notice the trailing space ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV, once again my ignorance shows no bounds ! Much appreciated support, hence site donation on its way !
rgds
OOS

"No-one got everything done by Friday except Robinson Crusoe...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top