Works like a charm with .address! Thanks!
I'm new to working with BB and with ranges like this, so please excuse any ignorance. In step 2 of my macro, I look at data that was pulled in from BB and delete certain rows based on criteria. The errors I get in this step are included in the comments in the code. I don't understand why I am getting a data type mismatch error for the Month(Date) criteria, which deletes rows where column D is not in the current month. I also don't understand why I'm getting an object required error for the <> "CALLED IN FULL" part of the code. This deletes rows where column F is not equal to CALLED IN FULL. Here is the code:
Sub Step_2()
'This step of the Callable Bonds Download macro deletes the bad data from each Security Type
'Cuts and pastes and security where Security Type is Corp and 0<Factor<1 into a new spreadsheet
'Verify that this factor is for the current month; if not, delete entire row
For Each ws In Sheets
ws.Activate
Dim A As Long, B As Long
A = Range("B" & Rows.Count).End(xlUp).Row
For B = A To 1 Step -1
Set rng1 = Range("A" & B)
Set rng2 = Range("B" & B)
Set rng3 = Range("C" & B)
Set rng4 = Range("D" & B)
Set rng5 = Range("E" & B)
Set rng6 = Range("F" & B)
'Check to make sure that the cells are NOT requesting data
'Delete bad data from Corp
If rng3.Value Like "*Corp" And rng6.Value Like "1" Then Rows(B).Delete
If rng3.Value Like "*Corp" And rng6.Value Like "0" Then Rows(B).Delete
If rng3.Value Like "*Corp" And rng4.Value Like "#N/A*" Then Rows(B).Delete
If rng3.Value Like "*Corp" And rng5.Value Like "#N/A*" Then Rows(B).Delete
If rng3.Value Like "*Corp" And rng6.Value Like "#N/A*" Then Rows(B).Delete
If rng3.Value Like "*Corp" And rng4.Value <> Month(Date) Then Rows(B).Delete
'Getting error:Data type mismatch above
'Delete bad data from Muni
If rng3.Value Like "*Muni" And rng6.Value <> "CALLED IN FULL" Then Rows(B).Delete
'Getting error:Oject Required above
If rng3.Value Like "*Muni" And rng4.Value <> Month(Date) Then Rows(B).Delete
'Getting error:Data type mismatch above
'Delete bad data from Pfd
If rng3.Value Like "*Pfd" And rng4.Value Like "#N/A*" Then Rows(B).Delete
If rng3.Value Like "*Pfd" And rng5.Value Like "#N/A*" Then Rows(B).Delete
If rng3.Value Like "*Pfd" And rng4.Value <> Month(Date) Then Rows(B).Delete
'Getting error:Data type mismatch above
'For Corp, put any security with a factor other than 0 or 1 into a new spreadsheet
'Verify that factor is in current month
Next B
Next ws
Application.ScreenUpdating = True
Application.DisplayStatusBar = True
End Sub
Bookmarks