Hi All
I was give some code from Tony Jollans and it works perfect but when I try to put the code into a Command Button I've drawn on to the spreadsheet it doesn't work properly. The original question ws how to open spreadsheets and place a value in column A:A to whatever value I have on my template spreadsheet and then save the document that I've just opened as A1 and close it again. Here is the code.
For Each c In Range("A2", Range("A65535").End(xlUp))
Workbooks.Open c
With ActiveWorkbook.ActiveSheet.Cells(1, 1)
.Formula = c.Offset(, 1)
.AutoFill Range("A2", Range("B65535").End(xlUp).Offset(0, -1))
End With
ActiveWorkbook.Close True
Next
The error message I get is run time error 1004, Autofill method of range class fails.
It has to be a sort of an autofill as each spreadsheet has different amounts of rows.
I was give some code from Tony Jollans and it works perfect but when I try to put the code into a Command Button I've drawn on to the spreadsheet it doesn't work properly. The original question ws how to open spreadsheets and place a value in column A:A to whatever value I have on my template spreadsheet and then save the document that I've just opened as A1 and close it again. Here is the code.
For Each c In Range("A2", Range("A65535").End(xlUp))
Workbooks.Open c
With ActiveWorkbook.ActiveSheet.Cells(1, 1)
.Formula = c.Offset(, 1)
.AutoFill Range("A2", Range("B65535").End(xlUp).Offset(0, -1))
End With
ActiveWorkbook.Close True
Next
The error message I get is run time error 1004, Autofill method of range class fails.
It has to be a sort of an autofill as each spreadsheet has different amounts of rows.