meghanalissa
New Member
- Joined
- Jan 14, 2013
- Messages
- 20
I have a built two macros--one that calls the other. The first one copys down the formula in the last row, then paste's the values of the last cell. This code works if I just run it on one sheet
However, when I try to call it in the code below so that it will loop through all visible sheets in the workbook, it just repeats on the original tab.
Can anyone tell me what I am doing wrong that is not allowing my loop to proceed to the next worksheet?
Code:
Sub CopyDownAndPaste()
Dim Col As Range
For Each Col In Range("C:U").Columns
With Cells(Rows.Count, Col.Column).End(xlUp)
.Copy .Offset(1)
.Value = .Value
End With
Next
End Sub
However, when I try to call it in the code below so that it will loop through all visible sheets in the workbook, it just repeats on the original tab.
Code:
Sub UpdateAllSheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Visible Then ws.Select (False)
Application.Run ("CopyDownAndPaste")
Next
'Put top of page in view & select A1
For Each ws In ActiveWorkbook.Worksheets
If ws.Visible Then ws.Select (False)
SendKeys ("^{HOME}")
Range("A1").Select
Next
ActiveSheet.Select
End Sub
Can anyone tell me what I am doing wrong that is not allowing my loop to proceed to the next worksheet?