So, I need to paste a formula from Book1 into cells V21:V26 of several workbooks. (they all have same formatting and are in the same folder)
this is what I have so far. I made sure that what is to be pasted is already on the clipboard. I cannot get it to work. What is your advice?
Sub H()
Dim directory As String, fileName As String, sheet As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
directory = "H:\User\New folder"
fileName = Dir(directory & "*.xlsx")
Do While fileName <> ""
Workbooks.Open (directory & fileName)
For Each sheet In Workbooks(fileName).Worksheets
Workbooks(fileName).Worksheets(sheet.Name).Select _
Range("V21:V26").Select
Worksheets(sheet.Name).Paste
Next sheet
ActiveWorkbook.Save
Workbooks(fileName).Close
fileName = Dir()
Loop
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
Bookmarks