This is my first post so excuse me if i break any rules. I have hit a wall with a macro that needs some help from the pros.
I have a tab labeled "bonds" which acts as the main sheet in which all data is dumped and it has headers in row 1.
I have 4 other tabs - "ABS" , "CD's" , "TSY-Agency" , "CMO" that have identical headers in row 1 as well.
What I am trying to do is program a macro that looks in "Column A" on the "bonds" tab and if any cell in that column has 1 of 4 values the entire row is cut and pasted to its corresponding sheets. For example: A2 = "ABS" then the macro will cut and paste the entire row to A2 on the "ABS tab." A3 = "TSY" then the macro will cut and paste the entire row to the "TSY-Agency tab." and so forth.
On the "bonds" tab there will be many repeats of of all 4 categories and they may be in different order. The following is what i have so far and it only works for the ABS, not the other categories. If there is a more efficient way of doing it please let me know.
- Code: Select all
Set i = Sheets("bonds")
Set e = Sheets("ABS")
Dim d
Dim j
d = 1
j = 2
Do Until IsEmpty(i.Range("A" & j))
If i.Range("A" & j) = "ABS" Then
d = d + 1
e.Rows(d).Value = i.Rows(j).Value
End If
j = j + 1
Loop
Thank you very much