soccerjon1013
New Member
- Joined
- Apr 16, 2012
- Messages
- 48
I should mention first, i'm new to the VBA and trying to learn, please excuse any of my rookie mistakes, and I greatly appreciate all of the help/input anyone is able to provide.
I have a report that we run daily. It involves pasting data from a database, removing rows with no Call Disposition, highlight row yellow from A-AL if Call Disposition is "Completed Survey", if any row in Q10 = "Yes" then insert column between AC and AD. There is a group of cells on tab "Totals Formatted" B21:b23 that reference the first tab "Daily Report Total" column AD. Since the column is inserted, it will change the reference from AD to AE. We would need to replace the reference in those cells to AD.
The conditional formatting would be a nice touch, but if I could have help with the rest of this, it would be help much.
I put in AL1 the formula =countif(AC:AC,"Yes")
There issues I'm having are as follow:
I have a report that we run daily. It involves pasting data from a database, removing rows with no Call Disposition, highlight row yellow from A-AL if Call Disposition is "Completed Survey", if any row in Q10 = "Yes" then insert column between AC and AD. There is a group of cells on tab "Totals Formatted" B21:b23 that reference the first tab "Daily Report Total" column AD. Since the column is inserted, it will change the reference from AD to AE. We would need to replace the reference in those cells to AD.
The conditional formatting would be a nice touch, but if I could have help with the rest of this, it would be help much.
I put in AL1 the formula =countif(AC:AC,"Yes")
There issues I'm having are as follow:
- Where it searches through A:A for cells with no call disposition, it looks like it is not selecting them as blank, perhaps I need to be looking for "" instead? What would be the right way to do so?
- It's not adding a column
- The steps to replace AE:AE with AD:AD give the formula a #REF value
- I have no idea where to start with the conditional formatting
Code:
Sub Install_Survey()'
' Install_Survey Macro
' Macro recorded 1/10/2015
'
' Keyboard Shortcut: Ctrl+q
'
' Sort 1st
Cells.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:=Range("AC2") _
, Order2:=xlDescending, Key3:=Range("AD2"), Order3:=xlDescending, Header _
:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
xlSortNormal
' Delete Empty Disposition
Columns("A:A").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Delete
' Sort 2nd
Cells.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:=Range("AC2") _
, Order2:=xlDescending, Key3:=Range("AD2"), Order3:=xlDescending, Header _
:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
xlSortNormal
' Insert column if any issues
' Search for Yes for Q10
If AL1 > 0 Then
Columns(29).Select
Selection.Insert Shift:=xlToRight
End If
If AL1 > 0 Then
' Replace Reason counts on last tab
Sheets("Totals Formatted").Select
Range("B21:B33").Select
Selection.Replace What:="AE:AE", Replacement:="AD:AD", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="AE:AE", Replacement:="AD:AD", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Sheets("Daily Report Total").Select
Range("A2").Select
End If
End Sub