0

This should be a simple fix but I cannot find an answer to this online. I am trying to apply a number format for multiple columns.

.Columns("W:Y, AB:AC").NumberFormat = "#,##0.0%;[Red](#,##0.0%)"

However, when I apply this code, I get a "mismatch" error. I can run this code fine if split up the column ranges but when I try to combine them to make my code more efficient, it fails.

Any help would be greatly appreciated.

Thanks,

GCC

Mesut Akcan
  • 899
  • 7
  • 19
GCC
  • 285
  • 6
  • 23

1 Answers1

4

Per Peh's response below:

Range("W:Y,AB:AC").NumberFormat = "#,##0.0%;[Red](#,##0.0%)"
DevGin
  • 443
  • 3
  • 12
  • You can omit the selecting. – Andy G Nov 29 '18 at 16:19
  • 5
    Please never use `.Select` [How to avoid using Select in Excel VBA](https://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba) • `Range("W:Y,AB:AC").NumberFormat = "#,##0.0%;[Red](#,##0.0%)"` – Pᴇʜ Nov 29 '18 at 16:19