Share via

Adding text to multiple files in same folder

Anonymous
2010-07-14T10:19:24+00:00

I have 50 or so Risk Assessments that have been created in Excel 2003 in a folder and numbered consecutively. All contain the same text and I now need to add two lines of text to each of the 50. Is there a way of copying and pasting to multiple files at the same time? Regards, Tony

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2010-07-14T11:59:56+00:00

You would need to create a macro, along these lines, with the items in italics changed to suit your needs:

Sub UpdateAllRiskAssessments()

  Dim I As Integer

  Const cstPath = "C:\My Folder\Risk Assessments"  Dim stFile As String

  For I=1 To 50

    stFile = "MyRiskAssess" & I & ".xls"    Workbooks.Open cstPath & stFile

    ActiveWorkbook.Sheets("Sheet1").Range("Z99").Value ="New text"

    ActiveWorkbook.Close SaveChanges:=True

  Next

End Sub


Bill Manville. Excel MVP, Oxford, England. www.manville.org.uk

Was this answer helpful?

0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2010-07-15T08:08:43+00:00

    Thanks for the response  Ron - its far too advanced for me though!!

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2010-07-14T16:23:19+00:00

    See also

    http://www.rondebruin.nl/copy4.htm


    Regards Ron de Bruin

    http://www.rondebruin.nl/tips.htm

    "danmelad" wrote in message news:*** Email address is removed for privacy ***...

    I have 50 or so Risk Assessments that have been created in Excel 2003 in a folder and numbered consecutively. All contain the same text and I now need to add two lines of text to each of the 50. Is there a way of copying and pasting to multiple files at the same time? Regards, Tony

    Was this answer helpful?

    0 comments No comments