简体   繁体   中英

Need help in Excel macro for merged cells

I am Preparing a CSV from Excel. There are few merged cells in excel. Need to make the excel ready for converting to csv file. so need to Un merge excel cells and fill those columns headers repetitive for all cells.Need a MAcro in VBA to achive this

示例图像

You can use .MergeCells = False look at this example below:

Sub merge_Bouton1_Clic()
    With Range("A1:C1")
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlCenter
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Range("A1").Copy
    Range("B1:C1").PasteSpecial xlPasteValues
    Application.CutCopyMode = xlCopy
    
End Sub

[RESULT]:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM