Screenshot of my excel spreadsheet
When i press the button it should add all the columns in row 2.
This is my code so far:
Sub Button1_Click()
    Range("b2").Select
    ActiveCell.End(xlToRight).Select
    Range("b2").Select
    ActiveCell.End(xlToRight).Select
    Dim vStartRow As Integer
    vStartRow = 2
    Dim vStartCol As Integer
    vStartCol = 2
    Dim vEndCol As Integer
    vEndCol = ActiveCell.Column
    Dim ColumnLetter As String
    ColumnLetter = Split(Cells(1, vEndCol).Address, "$")(1)
    Dim MyCol As String
    MyCol = ColumnLetter
    MsgBox (ColumnLetter)
    Cells(vEndCol + 2, 10).Formula = "=sum(" & vStartCol & vStartRow & ":"" & MyCol & "" vStartRow & "")"
    Cells(vEndCol + 2, 10).Select
End Sub
I get an error "Application-Difined or object-defined error" can someone please fix this error for me, thank you in advance!
 
    