Copy Employee IDs to same cell in multiple worksheets.

Closed
Srinivas - 21 May 2017 à 05:49
vcoolio Posts 1411 Registration date Thursday 24 July 2014 Status Contributor Last seen 6 September 2024 - 21 May 2017 à 08:05
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 1411 Registration date Thursday 24 July 2014 Status Contributor Last seen 6 September 2024 262
21 May 2017 à 08:05
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.