Copy values of a list one by one to multiple worksheets

amir2552

New Member
Joined
Aug 19, 2022
Messages
2
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
I have an "Input" spreadsheet with a list of unique values. Then I have a series of worksheets that are identical templates. I want to paste each unique value from the list on the "Input" sheet into the same cell within each of the separate worksheet templates. Is there a Marco / VBA code that could automate this for me?
An example is below:

"Input" Sheet:
Template Serial No.
1 755888
2 726958
3 745236
4 845694
5 788956

In the Worksheet currently named "1", I want Serial No. "755888" pasted in Cell "C3". And if possible the worksheet renamed to "755888"
In the Worksheet currently named "2", I want Serial No. "726958" pasted in Cell "C3". And if possible the worksheet renamed to "726958"
In the Worksheet currently named "3", I want Serial No. "745236" pasted in Cell "C3". And if possible the worksheet renamed to "745236"
.....and so on.... through the entire list of values in the "Input" sheet. The cell I want the value pasted in for each worksheet will be fixed and the same for each worksheet.

Thank you,
 

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.
Assuming that the "Input" sheet and the sheets 1,2,3, ...etc. exist and are in the same file, you can use this code:

VBA Code:
Sub macro1()
Dim x as Integer
With Sheets("Input")
x = 1
Do Until IsEmpty(.Range("a" & x))
.Range("a" & x).Copy Sheets(x).Range("c3")
Sheets(x).Name = .Range("a" & x).Value
x = x + 1
Loop
End With
End Sub
 
Upvote 0
Assuming that the "Input" sheet and the sheets 1,2,3, ...etc. exist and are in the same file, you can use this code:

VBA Code:
Sub macro1()
Dim x as Integer
With Sheets("Input")
x = 1
Do Until IsEmpty(.Range("a" & x))
.Range("a" & x).Copy Sheets(x).Range("c3")
Sheets(x).Name = .Range("a" & x).Value
x = x + 1
Loop
End With
End Sub
Thank you Francoise,

Can you update the code if the sheets' names are letters (not 1, 2, 3)?
 
Upvote 0
If the sheet "Input" is the first sheet, make sure that the following sheets are sheets 2, 3, 4, etc. (sheet numbers, not sheet names). If so, you can use this macro:
VBA Code:
Sub macro1()
Dim x As Integer
With Sheets("Input")
x = 1
Do Until IsEmpty(.Range("a" & x))
.Range("a" & x).Copy Sheets(x + 1).Range("c3")
Sheets(x + 1).Name = .Range("a" & x).Value
x = x + 1
Loop
End With
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,224,737
Messages
6,180,659
Members
452,992
Latest member
TokugawaIesuma

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