EAlexWolfe
New Member
- Joined
- Aug 6, 2024
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
I need a VBA macro that works on all worksheets in the active workbook. The macro should start by applying a filter to the range A4. Then, it should sort the rows starting from row 5 to the last populated row, based on the values in column U, in descending order. After sorting, I want the macro to format the values in columns J and K (from row 5 downwards) as numbers without decimals and with comma separators.
Next, the macro should highlight specific cells in light red. It should highlight cells in column K if the value in cell H2 is C (indicating a Markup) and the volume in K does not meet certain criteria based on the value in N2. Similarly, it should highlight cells in column J if the value in F2 is C (indicating a Markdown) and the volume in J does not meet certain criteria based on the value in M2. Additionally, any cells in column D from row 5 downwards that match the value in G2 should also be highlighted in light red, as well as any cells in column V from row 5 downwards that contain a value less than 50. After applying the red highlights, the macro should check for the first row with no red highlights. If the value in column U of that row is greater than or equal to the value in Q2, the entire row should be highlighted in light green. If no row meets the green highlighting criteria, the macro should look for a row where the value in column U is within 0.05% of the value in Q2, and if found, highlight that row in a light dusty blue (RGB: 176, 196, 222). If neither of these conditions is met, the topmost row that had no red highlights should be highlighted in a slightly darker shade of red (RGB: 255, 160, 160).
Finally, the macro should display a message box indicating that the highlighting is completed for all sheets.
Next, the macro should highlight specific cells in light red. It should highlight cells in column K if the value in cell H2 is C (indicating a Markup) and the volume in K does not meet certain criteria based on the value in N2. Similarly, it should highlight cells in column J if the value in F2 is C (indicating a Markdown) and the volume in J does not meet certain criteria based on the value in M2. Additionally, any cells in column D from row 5 downwards that match the value in G2 should also be highlighted in light red, as well as any cells in column V from row 5 downwards that contain a value less than 50. After applying the red highlights, the macro should check for the first row with no red highlights. If the value in column U of that row is greater than or equal to the value in Q2, the entire row should be highlighted in light green. If no row meets the green highlighting criteria, the macro should look for a row where the value in column U is within 0.05% of the value in Q2, and if found, highlight that row in a light dusty blue (RGB: 176, 196, 222). If neither of these conditions is met, the topmost row that had no red highlights should be highlighted in a slightly darker shade of red (RGB: 255, 160, 160).
Finally, the macro should display a message box indicating that the highlighting is completed for all sheets.