Hi,
Need some help with the VBA code. I am trying to insert two columns, insert formulas in those two columns
and then eventually want to copy down the formula in the entire column. I am only half way the code and stuck at the "Thisworkbook.Worksheets("Transposed Data").
I got this code online, modified a bit to fit my needs, but can't seem to figure out this error.
Any help would be greatly appreciated.
Thanks!
Sub AddColumns()
'Inserts Two Columns at e and f
Worksheets(1).Range("e:f").EntireColumn.Insert
Worksheets(1).Range("e1").Formula = "Score%"
Worksheets(1).Range("f1").Formula = "Month"
'Inserts specific formulae to cells e2 and f2
Dim Formulas(1 To 2) As Variant
With ThisWorkbook.Worksheets("Transposed Data")???? SCRIPT OUT OF RANGE ERROR
Formulas(1) = "=IFERROR(c2/SUM(D:D), "")"
Formulas(2) = "=Month(G2)"
.Range("E2:F2").Formula = Formulas
'Changes number format in Columns E and F to general
.Range("E:F").NumberFormat = "General"
End With
End Sub
Need some help with the VBA code. I am trying to insert two columns, insert formulas in those two columns
and then eventually want to copy down the formula in the entire column. I am only half way the code and stuck at the "Thisworkbook.Worksheets("Transposed Data").
I got this code online, modified a bit to fit my needs, but can't seem to figure out this error.
Any help would be greatly appreciated.
Thanks!
Sub AddColumns()
'Inserts Two Columns at e and f
Worksheets(1).Range("e:f").EntireColumn.Insert
Worksheets(1).Range("e1").Formula = "Score%"
Worksheets(1).Range("f1").Formula = "Month"
'Inserts specific formulae to cells e2 and f2
Dim Formulas(1 To 2) As Variant
With ThisWorkbook.Worksheets("Transposed Data")???? SCRIPT OUT OF RANGE ERROR
Formulas(1) = "=IFERROR(c2/SUM(D:D), "")"
Formulas(2) = "=Month(G2)"
.Range("E2:F2").Formula = Formulas
'Changes number format in Columns E and F to general
.Range("E:F").NumberFormat = "General"
End With
End Sub