Copy Employee IDs to same cell in multiple worksheets.

Closed
Srinivas - Updated on May 21, 2017 at 08:10 AM
vcoolio Posts 1404 Registration date Thursday July 24, 2014 Status Moderator Last seen September 15, 2023 - May 21, 2017 at 08:05 AM
Hello sir

I have 400 sheets in workbook in first work sheet from I2 to I400 i have employee numbers Which i want to copy automatically to all 399 sheets to cell C15 one by one

Below is the example

123
876
788
667

Sheet2 in cell C15 123
Sheet3 in cell C15 876
Sheet4 in cell C15 788

Can anyone help me with solution rather than i do manually all 400 sheets

Thanks





1 response

vcoolio Posts 1404 Registration date Thursday July 24, 2014 Status Moderator Last seen September 15, 2023 259
May 21, 2017 at 08:05 AM
Hello Srinivas,

Without knowing how your work book is set up, I assume that the 399 employee sheets are named with the employee numbers. Hence, I think that the following code, placed in a standard module and assigned to a button, should work for you:-

Sub InsertIDs()

Dim ws As Worksheet

Application.ScreenUpdating = False

i = 2

For Each ws In Worksheets
       If ws.Name <> "Sheet1" Then
         ws.[C15].Value = Sheet1.Cells(i, 9).Value
           i = i + 1
      End If
Next ws

Application.ScreenUpdating = True
MsgBox "All done!", vbExclamation

End Sub


I hope that this helps.

Cheerio,
vcoolio.
0