copying data to muliple worksheets

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I wish to automate the following routine:

For a list of named worksheets, say in rows a1 to a25 (the list matches the
names of the worksheets within the workbook), I want to select each item in
the list, calc, and then copy a range (d1:F50) as values to the same cells in
the associated worksheet.

Thanks!

Kevin
 
You can test this
Replace
MsgBox SNameRng.Value

With the code you want

For example
ThisWorkbook.Worksheets(SNameRng.Value).Range("D1:F50").Copy

Sub test()
Dim SNameRng As Range
For Each SNameRng In ThisWorkbook.Sheets("Sheet1").Columns("A").SpecialCells(xlCellTypeConstants)
If SheetExists(SNameRng.Value, ThisWorkbook) = True Then

MsgBox SNameRng.value

End If
Next SNameRng
End Sub

Function SheetExists(SName As String, _
Optional ByVal WB As Workbook) As Boolean
'Chip Pearson
On Error Resume Next
If WB Is Nothing Then Set WB = ThisWorkbook
SheetExists = CBool(Len(WB.Sheets(SName).Name))
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top