Hi,
I am a starter in VBA. Below is apart of code in which I am getting run time error 13 at the bolded and the under lined line. Can I have some suggestions how to rectify this.
Option Base 1
Sub sheetName()
Dim ws As Worksheet
Dim myArray As Variant
Set ws = Worksheets.Add
ws.Name = "List"
ws.Move After:=Sheets(Sheets.Count)
With ws
For i = 1 To Sheets.Count - 1
.Cells(i, 1).Value = Sheets(i).Name
Next i
End With
lr = ws.Range("A" & Rows.Count).End(xlUp).Row
For j = 1 To lr
myArray(j) = ws.Cells(j, 1).Value
Next j
For n = 1 To lr
myArray(n).Range("A1:D4").Interior.ColorIndex = 6
Next n
End Sub
Any Help on where I am going wrong.
Posted here also but invain:http://www.mrexcel.com/forum/showthread.php?t=388162
Bookmarks