Posts

Showing posts from May, 2017

VBScript tips - excel macro to fill formula

Thanks for the post here , then I can now use the syntax highlight in google post.  As a programmer, takes several hours to figure out some vb usage. Some performances/concepts are different as normal programming language. So I summary some tips as below: The example snippet I implemented is as below, this macro will generate excel formula and fill them to the excel file. Sub FillReportSummary() ' ' FillReportSummary Macro ' ' Dim description As Variant description = Array("Type A", "Type B", "Type C", "Type D") Dim headerNum As Integer headerNum = UBound(description) + 1 'MsgBox ("headerNum: " & headerNum & description(0)) Dim headerFormulas() As Variant ReDim headerFormulas(1 To headerNum) Dim strFormulas() As Variant ReDim strFormulas(1 To headerNum) Dim calSumFormula As String 'With ThisWorkbook.Sheets("SheetName") With ActiveWo...