TravelingMan
New Member
- Joined
- Jun 8, 2015
- Messages
- 8
hey guys,
I have a tab that has main info. The tab has the code below to filter out and create new sheets based on a word.
I am trying to get certain cells from the output to be placed in corresponding cells within other tabs instead of random sheets. how can I have the data go from the main tab and move to other tabs (tabs available are 201, 101, 301, 401) cells to be placed in B22, C22, E22 OF Each corresponding tab
Sub test()
Dim myAreas As Areas, myArea As Range, n As Long
Const wsName As String = "Result"
CheckWS wsName
Sheets(wsName).Cells.Clear
With Sheets("Aged DQ").Cells(1).CurrentRegion
.Rows(1).Copy Sheets(wsName).[b1]: n = 2
On Error Resume Next
Set myAreas = .Columns(1).SpecialCells(2, 1).Areas
On Error GoTo 0
If Not myAreas Is Nothing Then
For Each myArea In myAreas
myArea(0).Copy Sheets(wsName).Cells(n, 1).Resize(myArea.Count)
myArea.Resize(, .Columns.Count).Copy Sheets(wsName).Cells(n, 2)
n = n + myArea.Count
Next
Else
MsgBox "No dates"
End If
End With
End Sub
Is there a better way? I am not good at VBA but trying to learn. also,
see the sheet attached.
As you can see there are numbers and dates in the same column (these need to be separated)
Every number would have a created worksheet.. (which will already be generated) Information in the Date column (not whole numbers would need to be dates starting in Cell b22 and going down.. category column would start at c22 in each sheet and go down and the amount column would start at E22 and go down.
any help would be appreciated.
I have a tab that has main info. The tab has the code below to filter out and create new sheets based on a word.
I am trying to get certain cells from the output to be placed in corresponding cells within other tabs instead of random sheets. how can I have the data go from the main tab and move to other tabs (tabs available are 201, 101, 301, 401) cells to be placed in B22, C22, E22 OF Each corresponding tab
Sub test()
Dim myAreas As Areas, myArea As Range, n As Long
Const wsName As String = "Result"
CheckWS wsName
Sheets(wsName).Cells.Clear
With Sheets("Aged DQ").Cells(1).CurrentRegion
.Rows(1).Copy Sheets(wsName).[b1]: n = 2
On Error Resume Next
Set myAreas = .Columns(1).SpecialCells(2, 1).Areas
On Error GoTo 0
If Not myAreas Is Nothing Then
For Each myArea In myAreas
myArea(0).Copy Sheets(wsName).Cells(n, 1).Resize(myArea.Count)
myArea.Resize(, .Columns.Count).Copy Sheets(wsName).Cells(n, 2)
n = n + myArea.Count
Next
Else
MsgBox "No dates"
End If
End With
End Sub
Is there a better way? I am not good at VBA but trying to learn. also,
see the sheet attached.
As you can see there are numbers and dates in the same column (these need to be separated)
Every number would have a created worksheet.. (which will already be generated) Information in the Date column (not whole numbers would need to be dates starting in Cell b22 and going down.. category column would start at c22 in each sheet and go down and the amount column would start at E22 and go down.
any help would be appreciated.