I have this code, made with the macro recorder. How can I make it more dynamic so it does not matter how many rows there are? The columns do not change but the rows do.
Attribute VB_Name = "Module2"
Sub ComputeTotals()
Attribute ComputeTotals.VB_Description = "Macro recorded 2/27/2009 by Me"
Attribute ComputeTotals.VB_ProcData.VB_Invoke_Func = " \n14"
'
' ComputeTotals Macro
' Macro recorded 2/27/2009 by Me
'
'
UserNum = InputBox("Enter Number of Students that Answered")
ActiveCell.FormulaR1C1 = "Column"
Range("A379").Select
ActiveCell.FormulaR1C1 = "Strongly Agree"
Range("A380").Select
ActiveCell.FormulaR1C1 = "Agree"
Range("A381").Select
ActiveCell.FormulaR1C1 = "Somewhat Agree"
Range("A382").Select
ActiveCell.FormulaR1C1 = "Somewhat Disagree"
Range("A383").Select
ActiveCell.FormulaR1C1 = "Disagree"
Range("A384").Select
ActiveCell.FormulaR1C1 = "Strongly Disagree"
Range("C384").Select
Columns("A:A").EntireColumn.AutoFit
Range("C379").Select
ActiveCell.FormulaR1C1 = "=(COUNTIF(C[2],""Strongly Agree"")/" & UserNum & ")"
Range("C380").Select
ActiveCell.FormulaR1C1 = "=(COUNTIF(C[2],""Agree"")/" & UserNum & ")"
Range("C381").Select
ActiveCell.FormulaR1C1 = "=(COUNTIF(C[2],""Somewhat Agree"")/" & UserNum & ")"
Range("C382").Select
ActiveCell.FormulaR1C1 = "=(COUNTIF(C[2],""Somewhat Disagree"")/" & UserNum & ")"
Range("C383").Select
ActiveCell.FormulaR1C1 = "=(COUNTIF(C[2],""Disagree"")/" & UserNum & ")"
Range("C384").Select
ActiveCell.FormulaR1C1 = "=(COUNTIF(C[2],""Strongly Disagree"")/" & UserNum & ")"
Range("C377").Select
ActiveCell.FormulaR1C1 = "E"
Range("D377").Select
ActiveCell.FormulaR1C1 = "F"
Range("E377").Select
ActiveCell.FormulaR1C1 = "G"
Range("F377").Select
ActiveCell.FormulaR1C1 = "H"
Range("G377").Select
ActiveCell.FormulaR1C1 = "I"
Range("H377").Select
ActiveCell.FormulaR1C1 = "J"
Range("I377").Select
ActiveCell.FormulaR1C1 = "K"
Range("J377").Select
ActiveCell.FormulaR1C1 = "L"
Range("K377").Select
ActiveCell.FormulaR1C1 = "M"
Range("L377").Select
ActiveCell.FormulaR1C1 = "N"
Rows("377:384").Select
Selection.Font.Bold = True
Range("C379:C384").Select
Selection.NumberFormat = "0.00%"
Selection.AutoFill Destination:=Range("C379:L384"), Type:=xlFillDefault
Range("C379:L384").Select
Range("A386").Select
End Sub
Bookmarks