View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Macro to populate same cell on multiple worksheets

One way.Use instead of yours for sheets ws-4 & ws-6

Sub dosheets()
myarray = Array(4, 6)
For Each c In myarray
Sheets("ws-" & c).Range("b1").value = Range("a1").value
Next c
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"tomhelle" wrote in message
...
I have a workbook consisting of multiple worksheets (e.g. worksheet 1 thru
50). I am creating a €śdash board€ť worksheet (€śJob Set-Up€ť) that will
enable
the user to input a cell selection (A1) that will populate a specified
cell
(B1) on specified worksheets (WS-2, WS-4, etc.)

I have limited experience with VBA therefore, I try to utilize the €śrecord
macro€ť capabilities whenever possible. I have recorded the following macro
that copies and pastes (special) the values from A1 on WS-1 to B1 on WS-2
and
then returns back to the dashboard.

Sub Macro1()

Range("A1").Select
Selection.Copy
Sheets("WS-2").Select
Range("B1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("WS-1").Select
Application.CutCopyMode = False
End Sub

I want to edit this macro to paste the same values in cell B1 on certain
specified worksheets such as WS-4 and WS-6.

Is there a loop code that I can add to my recorded macro?

Many thanks in advance!