I am trying to add sheets to a workbook from a list...
I have it mostly working, it just puts them in the wrong order. I would like them to start at the end of the existing sheets and add to the end in the order of my list.
I have this code but it is erroring out when I try adding this >>>>after:=sheets(sheets,count) I am getting a syntax error
I know I have to count the sheets as they are added so it know where the end is but Im at a loss.
I also want to make it dynamic...so if the list grows the array picks it up and adds sheets accordingly...I havent got to this part yet
Sub addSheets()
Dim BidItem(1 To 15, 1 To 8)
Dim r As Long
Dim c As Long
Dim shNew As Worksheet
For r = 1 To 15
For c = 1 To 8
BidItem(r, c) = Cells(r, c).Value
Next c
Next r
For r = 1 To 15
Set shNew = Worksheets.Add after:=sheets(sheets,count) ' Errors here because of syntax error
shNew.Name = BidItem(r, 3)
shNew.Range("a2").Value = BidItem(r, 3)
shNew.Range("b2").Value = BidItem(r, 4)
shNew.Range("c2").Value = BidItem(r, 5)
shNew.Range("d2").Value = BidItem(r, 6)
Next r
End Sub
I have it mostly working, it just puts them in the wrong order. I would like them to start at the end of the existing sheets and add to the end in the order of my list.
I have this code but it is erroring out when I try adding this >>>>after:=sheets(sheets,count) I am getting a syntax error
I know I have to count the sheets as they are added so it know where the end is but Im at a loss.
I also want to make it dynamic...so if the list grows the array picks it up and adds sheets accordingly...I havent got to this part yet
Sub addSheets()
Dim BidItem(1 To 15, 1 To 8)
Dim r As Long
Dim c As Long
Dim shNew As Worksheet
For r = 1 To 15
For c = 1 To 8
BidItem(r, c) = Cells(r, c).Value
Next c
Next r
For r = 1 To 15
Set shNew = Worksheets.Add after:=sheets(sheets,count) ' Errors here because of syntax error
shNew.Name = BidItem(r, 3)
shNew.Range("a2").Value = BidItem(r, 3)
shNew.Range("b2").Value = BidItem(r, 4)
shNew.Range("c2").Value = BidItem(r, 5)
shNew.Range("d2").Value = BidItem(r, 6)
Next r
End Sub