Add sheet and name it. Please help. VBA to add 107 sheets

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Hi,
I want my activeworkbook to add 107 sheets and name sheets as per value from V2 to V108. Is that posible? I current have only one sheet
I want sheet2.name = range v2.value for example and go one till all 107 more sheets are added and name.
Thanks for helping.
Pedie
 
Do you mean something like

Code:
Dim sh As String
sh = Sheet1.Range("B1").Value
Sheet1.Range("C50:L50").Copy Destination:=Workbooks("Book1.xlsm").Worksheets(sh).Range("A1")
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
I want the name of all of those sheet to be my client name, and whenever
they update (from diff book) I want the code to cloose client name worksheet and update the info:biggrin:

This could be funny for some..lol!
 
Upvote 0
You really should consider using a database instead of Excel for this...

Pub - I'll have a double Marker's Mark with ice and some salted cashew nuts please!
 
Upvote 0
Yeah, a database would probably be best, but , with only 100+ clients, it can be done in Excel using only ONE sheet!!

lenze
 
Upvote 0
Vog, lemmi give that a try.
Thank you all for suggestions.
I want my client to use book1 and then update book2 which is now shared but protected with a password.
I am doing this because when 2 clients updates in the same time by finding lowest empty cell in B col. it overwrite the info
that is being updated by another user....so I'm trying to skip that problem by creating 107 more sheets seperately for every client..lol!
Please suggest me something better....
I just donno what I am doing..I am trying..
Everyine thanks again!
 
Upvote 0
Do you mean something like

Code:
Dim sh As String
sh = Sheet1.Range("B1").Value
Sheet1.Range("C50:L50").Copy Destination:=Workbooks("Book1.xlsm").Worksheets(sh).Range("A1")


Vog, the code above is working perfect but can we make the code skip to end with msgbox "U are not added" to data base....?
 
Upvote 0
Do you mean like this

Code:
Dim sh As String
sh = Sheet1.Range("B1").Value
Sheet1.Range("C50:L50").Copy Destination:=Workbooks("Book1.xlsm").Worksheets(sh).Range("A1")
MsgBox "Your message here", vbInformation
Exit Sub
 
Upvote 0
What I mean is that, suppose B1.value = name1 and the code does not find sheet named 'name1' then exit sub and my msgbox;)
 
Upvote 0
Try

Code:
Dim sh As String
sh = Sheet1.Range("B1").Value
On Error GoTo ErrHandl
Sheet1.Range("C50:L50").Copy Destination:=Workbooks("Book1.xlsm").Worksheets(sh).Range("A1")
Exit Sub
ErrHandl:
MsgBox "Your message here", vbInformation
End Sub
 
Upvote 0

Forum statistics

Threads
1,226,237
Messages
6,189,792
Members
453,568
Latest member
LaTwiglet85

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