简体   繁体   English

在合并单元格的 Excel 宏中需要帮助

[英]Need help in Excel macro for merged cells

I am Preparing a CSV from Excel.我正在从 Excel 准备 CSV。 There are few merged cells in excel. excel中合并单元格很少。 Need to make the excel ready for converting to csv file.需要准备好将 excel 转换为 csv 文件。 so need to Un merge excel cells and fill those columns headers repetitive for all cells.Need a MAcro in VBA to achive this所以需要取消合并excel单元格并填充所有单元格重复的那些列标题。需要在VBA中使用宏来实现这一点

示例图像

You can use .MergeCells = False look at this example below:你可以使用.MergeCells = False看看下面这个例子:

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]: [结果]:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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