Dear Forum,
I am writing a macro where I need to write a Formula in a specific column C based on the contents and the row size of the Column B..
Ex: The formula starts from the StartRow = 2 in the Column C and the LastRow of the Column A...
Its a simple Countif Formula to be auto inputted each time the Macro is run..
[ = COUNTIF("B2:B("A LastRow") ,B2) ]
Sub Add()
Dim StartRow As Integer
Dim LastRow As Integer
Dim wsIBSL As Worksheet
Set wsIBSL = Worksheets("IBSL")
With wsIBSL
StartRow = 2
LastRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
With .Range(.Cells(StartRow, 2), .Cells(LastRow, 2)) 'Column Heading - Cluster Name
.Formula = "=RC1&""+""&RC[5]"
.Value = .Value
End With
With .Range(.Cells(StartRow, 3), .Cells(LastRow, 3)) 'Column Heading - Region
'.FormulaR1C1 = "=COUNTIF(RC[-1]:RC[-1],RC[-1])"
.FormulaArray = Application.CountIf("B2:B" & LastRow, B2)
'.Value = .Value
End With
End With
End Sub
Can someone help me with the code in the column C based on the COlumn which is also a formula converted to a value...
Warm Regards
e4excel
Bookmarks