Dynamic Range

Jabberwokki

New Member
Joined
Dec 2, 2020
Messages
33
Office Version
  1. 2010
Platform
  1. 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
 
Glad to help & thanks for the feedback.
 
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,214,827
Messages
6,121,803
Members
449,048
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top