Hi,
The following loop works as intended
Sub testloop()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
On Error Resume Next 'Will continue if an error results
ws.Range("A2") = ws.Name
Next ws
End Sub
it loops through each spreadsheet in the workbook, putting the name of the sheet in A2.
The loop below DOES NOT work as intended.
Sub testmove()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
On Error Resume Next 'Will continue if an error results
Columns("D:E").Select
Selection.Copy
Range("F1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Columns("D:E").Select
Selection.delete
Next ws
End Sub
it loops through the code correctly, but ON THE SAME SHEET, not looping THROUGH the sheets. It just keep coping D and E to F, deleting D and E, over and over on the same sheet.
what is the problem?
thanks.
Bookmarks