PcMax

The Columns("H:I").ClearContents line only clears the cells - not any formatting - so if the cells are already formatted - then you may have trouble. If you want formatting removed then use .ClearFormats - in addition to .ClearContents

You have a lot of If then statements right after each other - maybe rewrite it as illustarted below

If cellx.Offset(-1, 0) > cellx and cellx.Offset(1, 0) > cellx Then


I am not familiar with using quatation marks this way - what does that mean Cells(RMax, 9) = """ 1 - 2"