Jabberwokki
New Member
- Joined
- Dec 2, 2020
- Messages
- 33
- Office Version
- 2010
- Platform
- Windows
Hi There And apologies cos i'm sure this has been answered hundreds of times before.
I'm trying to automate the creation of sheets in VBA using sheet names from a dynamic range of cells. The first cell containing a name is B14 and the last cell in the same column is dependent on a numeric value in cell D12 (this can vary).
This is what i've written so far but i'm getting an error when executing the code 'Wrong number of arguments or invalid property assignment'. Any help would be much appreciated.
Regards
Dominic
heres the code..........
Sub Add_Sheets_from_Cell_Value()
Sheets("Front").Select
Dim sRange
Dim eRange
Dim xRange As Range
Dim qq As Range
Set sRange = Range("B14")
eRange = Range("D12").Value
Set xRange = Range(sCell & eCell)
Application.ScreenUpdating = False
For Each qq In xRange
On Error Resume Next ' This will ignore any error
Sheets.Add(After:=Sheets(Sheets.Count)).Name = qq.Value
Next qq
Application.ScreenUpdating = True
End Sub
I'm trying to automate the creation of sheets in VBA using sheet names from a dynamic range of cells. The first cell containing a name is B14 and the last cell in the same column is dependent on a numeric value in cell D12 (this can vary).
This is what i've written so far but i'm getting an error when executing the code 'Wrong number of arguments or invalid property assignment'. Any help would be much appreciated.
Regards
Dominic
heres the code..........
Sub Add_Sheets_from_Cell_Value()
Sheets("Front").Select
Dim sRange
Dim eRange
Dim xRange As Range
Dim qq As Range
Set sRange = Range("B14")
eRange = Range("D12").Value
Set xRange = Range(sCell & eCell)
Application.ScreenUpdating = False
For Each qq In xRange
On Error Resume Next ' This will ignore any error
Sheets.Add(After:=Sheets(Sheets.Count)).Name = qq.Value
Next qq
Application.ScreenUpdating = True
End Sub