If you add a comman button in sheet one, and then write your code, itonly affects the parameters in sheet one. I need the command button toaffect multiple sheets. How do I modified my code so that the buttonaffects all sheets?
You can refer to any sheet - either by name or by index. Look at theWorkSheets and sheets collections (I think they both do the same thing).E.g.Option ExplicitPrivate Sub CommandButton1_Click()Worksheets(1).Range("a1").Value = 1Worksheets(2).Range("a1").Value = 2Sheets(1).Range("a2").Value = 1Sheets(2).Range("a2").Value = 2Sheets("Sheet1").Range("a3").Value = 1Sheets("Sheet2").Range("a3").Value = 2End Sub