Hi, I wonder whether someone may be able to help me please.
I'm using the code below to create multiple sheets in a given workbook.
Dim shArray() As Variant 'Declare the sheet Name array and a
Dim i As Long 'counter variable
shArray = Array("Monthly Direct", _
"Monthly Enhancements", _
"Monthly Indirect", _
"Monthly Overheads", _
"Monthly Projects", _
"Yearly Direct", _
"Yearly Enhancements", _
"Yearly Indirect", _
"Yearly Overheads", _
"Yearly Projects", _
"C&R In Flight Projects", _
"S&A In Flight Projects", _
"C&R Graph Data", _
"S&A Graph Data", _
"C&R Flexible Resource Profile", _
"S&S Flexible Resource Profile", _
"C&R Flexible Resource KPI", _
"C&R Resource Capacity") 'Populate the array
For i = LBound(shArray) To UBound(shArray) 'Loop through the elements
Sheets.Add(After:=Worksheets(Worksheets.Count)).Name = shArray(i)
shArray(i).Range("B3").Value = InputBox("Enter the month of the data you wish to use?")
Next
Call MonthlyExtract
Call DirIndOVHExtract
Call YearlyExtract
Call MonthlyFormat
Call YearlyFormat
End Sub
The code works except for this line:
shArray(i).Range("B3").Value = InputBox("Enter the month of the data you wish to use?")
What I'm trying to achieve, is to dispaly an 'Input Box' to allow the user to enter a date which will populate cell B3 in each of the created sheets. However, when I run this, although I can display the 'Input Box', when I enter the data, and click 'Ok', I receive a 'Run time' error highlighting this line as the cause.
I just wondered whether someone may be able to look at this please and let me know where I'm going wrong.
Many thanks and kind regards
Chris
Bookmarks