I want to name a range in an excel sheet that is created dynamically. I tried following but it is not working.
With oWB
For intCount = 1 To wbnum1
.Worksheets.Add(After:=.Worksheets(intCount + 1))
.Sheets(intCount + 1).Name = "Sheet" & intCount.ToString()
.Sheets(intCount + 1).Cells(19, 2).value = "Sheet" & intCount.ToString
.Sheets(intCount+1).Range("A1:Z1")
.Range.Name = "Numbers"
Next
what is wrong with this?
Thanks
.Sheets(intCount+1).Range("A1:Z1").Name = "Numbers"