Can anyone help
On a workbook I have the following code:
________________________________
Public Sub CommandButton1_Click()
Worksheets("Service").Visible = True
Worksheets("Service").Copy before:=Worksheets("data")
Worksheets("Service").Visible = False
ActiveSheet.Name = "Service(1)"
Dim I As Long
For I = 1 To Worksheets("Provider").Range("D25") - 1
Worksheets("Service").Visible = True
Worksheets("Service").Copy before:=Worksheets("data")
Worksheets("Service").Visible = False
Next I
Worksheets("data").Select
End Sub
____________________________________
I also have a control sheet of data called "data service" consisting of ColumnA "Name of Provider" A2:A69 and ColumnB"Service Number" B2:B69
Column B are unique numbers
Column A may contain duplicates of the same provider name
From the code listed above I need to pre-populate the service number on each new sheet created where the Provide Name on the newly created worksheet = Column A value on the "data service" worksheet and the service number is populated on the newly created worksheet cell "D7"
eg
If the Provider Name was "logic"
data service worksheet
Column A.........................................Column B
Name of Provider.............................Service No
logic................................................120
nre..................................................699
locic.................................................47
gwe.................................................220
nre..................................................156
logic................................................200
When the code is executed the code will run 3x as there are 3 occurances of "logic"
On "Service (1)" worksheet cell "D7" would equal 120
On "Service (2)" worksheet cell "D7" would equal 47
On "Service (3)" worksheet cell "D7" would equal 200
HELP !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
On a workbook I have the following code:
________________________________
Public Sub CommandButton1_Click()
Worksheets("Service").Visible = True
Worksheets("Service").Copy before:=Worksheets("data")
Worksheets("Service").Visible = False
ActiveSheet.Name = "Service(1)"
Dim I As Long
For I = 1 To Worksheets("Provider").Range("D25") - 1
Worksheets("Service").Visible = True
Worksheets("Service").Copy before:=Worksheets("data")
Worksheets("Service").Visible = False
Next I
Worksheets("data").Select
End Sub
____________________________________
I also have a control sheet of data called "data service" consisting of ColumnA "Name of Provider" A2:A69 and ColumnB"Service Number" B2:B69
Column B are unique numbers
Column A may contain duplicates of the same provider name
From the code listed above I need to pre-populate the service number on each new sheet created where the Provide Name on the newly created worksheet = Column A value on the "data service" worksheet and the service number is populated on the newly created worksheet cell "D7"
eg
If the Provider Name was "logic"
data service worksheet
Column A.........................................Column B
Name of Provider.............................Service No
logic................................................120
nre..................................................699
locic.................................................47
gwe.................................................220
nre..................................................156
logic................................................200
When the code is executed the code will run 3x as there are 3 occurances of "logic"
On "Service (1)" worksheet cell "D7" would equal 120
On "Service (2)" worksheet cell "D7" would equal 47
On "Service (3)" worksheet cell "D7" would equal 200
HELP !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!