jack.chan
(Jack Chan)
8
@Ray_Sha1
- paste below code in file e.g. vba.txt
- in excel application scope, call invoke vba activity
set codeFilePath = "vba.txt
"EntryMethodName" = “FormatAndMerge”
EntryMethodParameters = {“SheetName”, “textToWrite”, “cellsToMerge”}
e.g. {"Sheet1", "hi", "A1:A2"}
Function FormatAndMerge(sheetName As String, textToWrite As String, cellRange As String)
'
ActiveWorkbook.Sheets(sheetName).Activate
Range(cellRange).Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveCell.FormulaR1C1 = textToWrite
ActiveWorkbook.Save
End Function
1 Like