strato
08-27-2017, 11:22 AM
Hello
I am using Excel 2010 and am trying to crunch data then send the data to several worksheets.
Currently, I am able to filter out unneeded data and send to one sheet.
But, I need to filter out particular data to send to each sheet. There are 5 total sheets to send to.
I have the worksheets named since the worksheet seems to change every time this is ran.
I'm just taking a small part of this at one time.
So far I have ...
Sub SendtoBShift()
Dim Firstrow As Long
Dim LastRow As Long
Dim Lrow As Long
Dim ViewMode As Long
With ActiveSheet
.Select
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView
.DisplayPageBreaks = False
Firstrow = .UsedRange.Cells(1).Row
LastRow = .UsedRange.Rows(.UsedRange.Rows.Count).Row
'We loop from Lastrow to Firstrow (bottom to top)
For Lrow = LastRow To Firstrow Step -1
With .Cells(Lrow, "G") ' used to be col D
If Not IsError(.Value) Then
'This will send each row with the Value "B" to sheet B Shift
If .Value = "B" Then Worksheets("B Shift").Activate ' this line is the problem
End If
End With
Next Lrow
End With
End Sub
... but this still just sends to the first sheet.
Any help is appreciated
I am using Excel 2010 and am trying to crunch data then send the data to several worksheets.
Currently, I am able to filter out unneeded data and send to one sheet.
But, I need to filter out particular data to send to each sheet. There are 5 total sheets to send to.
I have the worksheets named since the worksheet seems to change every time this is ran.
I'm just taking a small part of this at one time.
So far I have ...
Sub SendtoBShift()
Dim Firstrow As Long
Dim LastRow As Long
Dim Lrow As Long
Dim ViewMode As Long
With ActiveSheet
.Select
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView
.DisplayPageBreaks = False
Firstrow = .UsedRange.Cells(1).Row
LastRow = .UsedRange.Rows(.UsedRange.Rows.Count).Row
'We loop from Lastrow to Firstrow (bottom to top)
For Lrow = LastRow To Firstrow Step -1
With .Cells(Lrow, "G") ' used to be col D
If Not IsError(.Value) Then
'This will send each row with the Value "B" to sheet B Shift
If .Value = "B" Then Worksheets("B Shift").Activate ' this line is the problem
End If
End With
Next Lrow
End With
End Sub
... but this still just sends to the first sheet.
Any help is appreciated