View Single Post
 
Old 11-10-2019, 11:36 AM
p45cal's Avatar
p45cal p45cal is offline Windows 10 Office 2019
Expert
 
Join Date: Apr 2014
Posts: 867
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

try:
Code:
Sub blah()
For Each cll In ActiveSheet.UsedRange.Cells
  If cll.MergeCells Then
    myValue = Empty
    myFormat = Empty
    Set mergedrange = cll.MergeArea
    mergedrange.UnMerge
    For Each celle In mergedrange.Cells
      If IsEmpty(celle.Value) Then
        celle.Value = myValue
        celle.NumberFormat = myFormat
      Else
        myValue = celle.Value
        myFormat = celle.NumberFormat
      End If
    Next celle
  End If
Next cll
End Sub
Note that this puts a 'hard' value (not a formula) in all but the first cell in merged areas.
Reply With Quote