0
Range("A1:D1").Select
With Selection
    .MergeCells = True
End With

Range("A1").Select
With Selection
    '.MergeCells = False   <--- Error Object Required
    .UnMerge   'Correct
End With

I prefer understanding odd things like this. It strikes me as a contradiction that a property can be set as True, but not False.

Mathieu Guindon
  • 69,817
  • 8
  • 107
  • 235
  • 4
    From the [documentation](https://learn.microsoft.com/en-us/office/vba/api/excel.application.selection), "Returns `Nothing` if no objects are selected." See [How to avoid using Select in Excel VBA](https://stackoverflow.com/q/10714251/4088852). – Comintern Feb 08 '19 at 18:42
  • @Comintern that would be error 91 though – Mathieu Guindon Feb 08 '19 at 19:51
  • No repro, this exact code works perfectly fine here (Excel 2016 x64). What version are you using? – Mathieu Guindon Feb 08 '19 at 19:56
  • I'm sorry if I wasn't clear. I'm not interested in the relative efficiencies of .Select statements. I simply find it odd that there is a property for a Range object (Range("A1:D1").MergeCells) that can only be set to True. Put another way, how many other examples are there of properties that can only bet set to *either* True or False, but not both? – user10818185 Feb 14 '19 at 19:02

0 Answers0