• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Fit and merge other cells determined by value

Kevin Lee

New Member
Using a VBA macro, I want to make column FG in the first photo to automatically merge and fit the values of column FE, and column FH should also merge and be in accordance with column FE. This would be determined by the values of column FE and FG. It’s a bit hard to explain, so I put a second photo which explains my desired output (Never mind the highlighted cells). I cannot figure out an appropriate solution for this. Thanks in advance!
BADA5023-DA1F-4C1E-BB9E-30B24F8C662D.png838E0F6F-1B05-48A2-8B99-ADEEA15EDD59.jpeg
 
With your Original Data sheet the active sheet, run:
Code:
Sub blah()
With Range("C2:C50")
  .Offset(, -1).Copy .Cells
  .FormulaR1C1 = "=IF(AND(RC2<>"""", RC5<>""""), VLOOKUP(RC2,R2C12:R10C13,2,TRUE), """")"
End With
End Sub
 
Do you have any idea on how to color the cells as shown in the second photo of my original post? I want to color the ‘Degree’ cells where its numbers are different from the cells right below, and also color the other cells in the same row with the colored cell. The tricky thing is, in case ‘Degree’ cell is a merged cell, the most bottom cell of the ‘Original score’ should be colored. (e.g. If row 5,6,7 are merged, only row 7 of ‘Original Score’ should be colored.)

I have tried many different options in VBA, including ‘while do’ statements but failed eventually.
 
Back
Top