I am trying to write a For...Next
loop to create a set number of Worksheet
s in a Workbook
. The the number of worksheets is set by the user from a dashboard, at an earlier point.
Can somebody point me in the right direction? This is my code, so far:
For i = 1 To siteCount
'I know the below won't work, and I also tried site_ & i, but no luck
Set site_i = Sheets.Add(after:=Sheets(Worksheets.Count))
site_i.Name = "Sheet Name"
Next i
With some small adjustments, your code will basically work: