CreativeUsername
Board Regular
- Joined
- Mar 11, 2017
- Messages
- 52
the following is not working. I'm not seeing why. also I need it to print In the Cell "A" for each line transferred
todays date (and it shouldn't update the next day) Cell "B" for each row transferred should be the Sheet name the data came from.
The following was working perfectly before putting in the loop. It doesn't have the date and sheet name part yet. Any help is appreciated.
Sub ArchiveTrans()
Dim ws As Worksheet
Dim LastRow As Long
Dim SourceWB As Workbook
Application.ScreenUpdating = False
'Select source location and range
For Each ws In SourceWB.Worksheets
If ws.Name <> "Change Control" And ws.Name <> "Archive" Then
ActiveSheet.Select
Set destRng = Sheets("Archive").Cells(Rows.Count, "C").End(xlUp).Offset(1, 0)
'Copy selected range to last row
LastRow = Range("B" & Rows.Count).End(xlUp).Row
Range("A:AK" & LastRow).Copy Destination:=destRng
End If
Next ws
With Application
.CutCopyMode = False
.ScreenUpdating = True
End With
End Sub
todays date (and it shouldn't update the next day) Cell "B" for each row transferred should be the Sheet name the data came from.
The following was working perfectly before putting in the loop. It doesn't have the date and sheet name part yet. Any help is appreciated.
Sub ArchiveTrans()
Dim ws As Worksheet
Dim LastRow As Long
Dim SourceWB As Workbook
Application.ScreenUpdating = False
'Select source location and range
For Each ws In SourceWB.Worksheets
If ws.Name <> "Change Control" And ws.Name <> "Archive" Then
ActiveSheet.Select
Set destRng = Sheets("Archive").Cells(Rows.Count, "C").End(xlUp).Offset(1, 0)
'Copy selected range to last row
LastRow = Range("B" & Rows.Count).End(xlUp).Row
Range("A:AK" & LastRow).Copy Destination:=destRng
End If
Next ws
With Application
.CutCopyMode = False
.ScreenUpdating = True
End With
End Sub