Saturday, 23 February 2019

Student Mark sheet Record in Excel VBA

Create Mark Sheet using Excel VBA

Today we create student mark sheet record system using excel VBA. this top is helpful for beginner in advanced excel. so that please follow the step which is given bellow.

Step 1: Create a Macro File with extension .xlsm

  • File -> Save As -> Browse -> Choose your Path & Give Name -> Change Save as Type “Excel Macro-Enabled Workbook”.

  • Step 2: Create a Mark sheet heading Like this


    Step 3: Open VBA Platform

  • Click on Developer tab -> Visual Basic (Alt+F11).

  • Step 4: Create UserForm

  • Insert -> UserForm - > And Create Interface Like this
  • (4 TextBox, 4 Label,1 Command Button)

  • Step 5 : Double Click Command Button(Add Student) or Enter Following Code

    Dim rnum As Integer
    Range("A1").Select
    rnum = Selection.End(xlDown).Row + 1

    step 6 : Create a macro and record all formulas of mark sheet

    You Get the Like this

    Range("A2").Select
    ActiveCell.FormulaR1C1 = "Rohit"
    Range("B2").Select
    ActiveCell.FormulaR1C1 = "35"
    Range("C2").Select
    ActiveCell.FormulaR1C1 = "48"
    Range("D2").Select
    ActiveCell.FormulaR1C1 = "75"
    Range("E2").Select
    ActiveCell.FormulaR1C1 = "=SUM(RC[-3]:RC[-1])"
    Range("F2").Select ActiveCell.FormulaR1C1 = "=MIN(RC[-4]:RC[-2])"
    Range("G2").Select
    ActiveCell.FormulaR1C1 = "=MAX(RC[-5]:RC[-3])"
    Range("H2").Select
    ActiveCell.FormulaR1C1 = "=AVERAGE(RC[-6]:RC[-4])"
    Range("H3").Select

    Step 7: cut this Code and paste into the command button after the given code

    Step 8: Modify the following code like this

    Dim rnum As Integer
    Range("A1").Select
    rnum = Selection.End(xlDown).Row + 1

    Range("A" & rnum).Select
    ActiveCell.FormulaR1C1 = TextBox1.Value ' Student Name
    Range("B" & rnum).Select
    ActiveCell.FormulaR1C1 = TextBox2.Value ' English
    Range("C" & rnum).Select
    ActiveCell.FormulaR1C1 = TextBox3.Value ' Hindi
    Range("D" & rnum).Select
    ActiveCell.FormulaR1C1 = TextBox4.Value ' Marathi
    Range("E" & rnum).Select
    ActiveCell.FormulaR1C1 = "=SUM(RC[-3]:RC[-1])"
    Range("F" & rnum).Select
    ActiveCell.FormulaR1C1 = "=MIN(RC[-4]:RC[-2])"
    Range("G" & rnum).Select
    ActiveCell.FormulaR1C1 = "=MAX(RC[-5]:RC[-3])"
    Range("H" & rnum).Select
    ActiveCell.FormulaR1C1 = "=AVERAGE(RC[-6]:RC[-4])"
    Range("H" & rnum).Select

    Step 9: Open Module 1 -> Type Code

    UserForm1.Show
    Inside the Function

    Step 10: Back to excel -> Developer -> Insert-> Button draw -> select Macro Function - > OK

    Finally it Done, now Press Button.




    Student Mark sheet Record in Excel VBA

    Create Mark Sheet using Excel VBA Today we create student mark sheet record system using excel VBA. this top is helpful for beginner in ...