{"id":257,"date":"2015-11-02T09:11:19","date_gmt":"2015-11-02T09:11:19","guid":{"rendered":"http:\/\/99excel.com\/?p=257"},"modified":"2021-05-14T16:08:49","modified_gmt":"2021-05-14T16:08:49","slug":"india-salary-tax-computation-in-excel-vba","status":"publish","type":"post","link":"https:\/\/99excel.com\/home\/india-salary-tax-computation-in-excel-vba\/","title":{"rendered":"India Salary tax computation in excel vba"},"content":{"rendered":"<p>Below we will look at a program in <strong>Excel VBA<\/strong> that calculates the tax on an income. The following <strong>tax rates<\/strong> apply to individuals who are residents of India.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/99excel.com\/wp-content\/uploads\/2015\/11\/Tax-Computation-CTC-Structure-2015-16.xlsm\">Download the&nbsp;Indian Salary tax computation in excel vba. Tax Computation &amp; CTC Structure 2015-16<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Code&nbsp;in open sheet<\/strong><\/p>\n<p>Private Sub Workbook_Open()<br \/>\nApplication.ScreenUpdating = False<br \/>\nApplication.DisplayAlerts = False<br \/>\nActiveWorkbook.Sheets(&#8220;Tax Computation &amp; CTC Structure&#8221;).Visible = xlSheetVisible<br \/>\nActiveWorkbook.Sheets(&#8220;Welcome&#8221;).Visible = xlSheetVeryHidden<br \/>\nApplication.Calculation = xlCalculationAutomatic<br \/>\nSheets(&#8220;Tax Computation &amp; CTC Structure&#8221;).Select<br \/>\n&#8216;Call My_Vba.Resetall<br \/>\nActiveWindow.ScrollColumn = 1<br \/>\nActiveWindow.ScrollColumn = 1<\/p>\n<p>End Sub<\/p>\n<p>Private Sub Workbook_Activate()<br \/>\nApplication.ScreenUpdating = False<br \/>\nActiveWorkbook.Protect (&#8220;password&#8221;)<br \/>\nApplication.ScreenUpdating = False<br \/>\nEnd Sub<\/p>\n<p>Private Sub Workbook_BeforeClose(Cancel As Boolean)<br \/>\nApplication.ScreenUpdating = False<br \/>\nActiveWorkbook.Unprotect (&#8220;password&#8221;)<br \/>\nActiveWorkbook.Sheets(&#8220;Welcome&#8221;).Visible = xlSheetVisible<br \/>\nActiveWorkbook.Sheets(&#8220;Tax Computation &amp; CTC Structure&#8221;).Visible = xlSheetVeryHidden<br \/>\nApplication.ScreenUpdating = False<br \/>\nApplication.DisplayAlerts = False<br \/>\nActiveWorkbook.Protect (&#8220;password&#8221;)<br \/>\nThisWorkbook.Close savechanges:=True<br \/>\nApplication.ScreenUpdating = False<br \/>\nEnd Sub<\/p>\n<p>&nbsp;<\/p>\n<hr>\n<p>&nbsp;<\/p>\n<p>following code in work sheet<\/p>\n<p>&nbsp;<\/p>\n<p>Private Sub Worksheet_Change(ByVal Target As Range)<br \/>\nDim KeyCells, KeyCells1, KeyCells2, KeyCells3, KeyCells4 As Range<\/p>\n<p>Set KeyCells = Range(&#8220;Annual_CTC&#8221;)<br \/>\nSet KeyCells1 = Range(&#8220;Bonus_Ap&#8221;)<br \/>\nSet KeyCells2 = Range(&#8220;Basic,Hra,Conv,metronmetro&#8221;)<br \/>\nSet KeyCells3 = Range(&#8220;Medical,lta,veh,driv,pd&#8221;) &#8216;enta<br \/>\nSet KeyCells4 = Range(&#8220;var_paya&#8221;)<br \/>\nSet KeyCells5 = Range(&#8220;PF_Ap,ESI_Ap,Gratuity_Ap,Bonus_Ap&#8221;)<br \/>\nSet KeyCells6 = Range(&#8220;Renta&#8221;)<\/p>\n<p>If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then<br \/>\nCall Missmatch<br \/>\nIf Range(&#8220;Spl_all&#8221;).Value &lt; 0 Then<br \/>\nRange(&#8220;lta&#8221;).Value = 0<br \/>\nRange(&#8220;veh&#8221;).Value = 0<br \/>\nRange(&#8220;driv&#8221;).Value = 0<br \/>\nElse: End If<\/p>\n<p>ElseIf Not Application.Intersect(KeyCells1, Range(Target.Address)) Is Nothing Then<br \/>\nApplication.DisplayAlerts = False<br \/>\nIf Range(&#8220;Bonus_Ap&#8221;).Value = &#8220;Yes&#8221; Then<br \/>\nRange(&#8220;bonus_amt&#8221;).Formula = &#8220;=IF(Annual_CTC&gt;0,IF(SUM(reimb_ff)&gt;0,0,10000),0)&#8221;<br \/>\nElse<br \/>\nRange(&#8220;bonus_amt&#8221;).Value = 0<\/p>\n<p>End If<\/p>\n<p>ElseIf Not Application.Intersect(KeyCells2, Range(Target.Address)) Is Nothing Then<br \/>\nApplication.DisplayAlerts = False<br \/>\nCall Missmatch<\/p>\n<p>ElseIf Not Application.Intersect(KeyCells3, Range(Target.Address)) Is Nothing Then<br \/>\nApplication.DisplayAlerts = False<br \/>\nCall Missmatch<br \/>\nRange(&#8220;lta&#8221;).Select<\/p>\n<p>ElseIf Not Application.Intersect(KeyCells4, Range(Target.Address)) Is Nothing Then<br \/>\nApplication.DisplayAlerts = False<br \/>\nCall Missmatch<br \/>\nRange(&#8220;comp_med&#8221;).Select<\/p>\n<p>ElseIf Not Application.Intersect(KeyCells5, Range(Target.Address)) Is Nothing Then<br \/>\nApplication.DisplayAlerts = False<br \/>\nCall Missmatch<br \/>\nRange(&#8220;PF_Ap&#8221;).Select<\/p>\n<p>ElseIf Not Application.Intersect(KeyCells6, Range(Target.Address)) Is Nothing Then<br \/>\nApplication.DisplayAlerts = False<\/p>\n<p>If Range(&#8220;Renta&#8221;).Value &gt; 0 Then<\/p>\n<p>If Range(&#8220;Renta&#8221;).Value &gt; 8333 Then<br \/>\nMsgBox (&#8220;Monthly rent is above Rs. 8333\/-, You required to report the PAN of the landlord to the employer at the end of year.&#8221;)<br \/>\nRange(&#8220;rentlocation&#8221;).Value = &#8220;Delhi&#8221;<br \/>\nRange(&#8220;from&#8221;).Formula = &#8220;=MAX(&#8221; &amp; &#8220;01\/04\/2014&#8221; &amp; &#8220;,Effectivedate)&#8221;<br \/>\nRange(&#8220;to&#8221;).Value = &#8220;31\/03\/2016&#8221;<br \/>\nElse: End If<br \/>\nRange(&#8220;rentlocation&#8221;).Value = &#8220;Delhi&#8221;<br \/>\nRange(&#8220;from&#8221;).Formula = &#8220;=MAX(&#8221; &amp; &#8220;01\/04\/2014&#8221; &amp; &#8220;,Effectivedate)&#8221;<br \/>\nRange(&#8220;to&#8221;).Value = &#8220;31\/03\/2016&#8221;<br \/>\nRange(&#8220;Renta&#8221;).Select<br \/>\nElse: End If<br \/>\nElse: End If<br \/>\nEnd Sub<\/p>\n<hr>\n<p>Sub Resetall()<br \/>\nOn Error Resume Next<br \/>\nSheets(&#8220;Tax Computation &amp; CTC Structure&#8221;).Unprotect Password:=&#8221;password&#8221;<br \/>\nApplication.ScreenUpdating = False<br \/>\nApplication.DisplayAlerts = False<\/p>\n<p>Range(&#8220;Annual_CTC&#8221;).Value = &#8220;0&#8221;<\/p>\n<p>Range(&#8220;Basic&#8221;).ClearContents<br \/>\nRange(&#8220;Basic&#8221;).Formula = &#8220;=ROUND(Annual_CTC*20%,0)&#8221;<\/p>\n<p>Range(&#8220;reimb_amt&#8221;).Value = &#8220;0&#8221;<br \/>\nRange(&#8220;itamt&#8221;).Value = &#8220;0&#8221;<br \/>\nRange(&#8220;var_paya&#8221;).Value = &#8220;0&#8221;<\/p>\n<p>Range(&#8220;Conv&#8221;).ClearContents<br \/>\nRange(&#8220;Conv&#8221;).Formula = &#8220;=IF(veh&gt;0,0,IF(Annual_CTC&gt;0,19200,0))&#8221;<\/p>\n<p>Range(&#8220;Medical&#8221;).ClearContents<br \/>\nRange(&#8220;Medical&#8221;).Formula = &#8220;=IF(Annual_CTC&gt;0,15000,0)&#8221;<\/p>\n<p>Range(&#8220;lta&#8221;).ClearContents<br \/>\nRange(&#8220;lta&#8221;).Formula = &#8220;=IF(Annual_CTC&gt;0,60000,0)&#8221;<\/p>\n<p>Range(&#8220;veh&#8221;).ClearContents<br \/>\nRange(&#8220;veh&#8221;).Formula = &#8220;=IF(Annual_CTC&gt;0,96000,0)&#8221;<\/p>\n<p>Range(&#8220;driv&#8221;).ClearContents<br \/>\nRange(&#8220;driv&#8221;).Formula = &#8220;=IF(Annual_CTC&gt;0,60000,0)&#8221;<\/p>\n<p>Range(&#8220;rentlocation&#8221;).ClearContents<br \/>\nRange(&#8220;from&#8221;).ClearContents<br \/>\nRange(&#8220;to&#8221;).ClearContents<\/p>\n<p>If Range(&#8220;Bonus_Ap&#8221;).Value = &#8220;Yes&#8221; Then<br \/>\nRange(&#8220;bonus_amt&#8221;).Formula = &#8220;=IF(Annual_CTC&gt;0,IF(SUM(reimb_ff)&gt;0,0,10000),0)&#8221;<br \/>\nElse<br \/>\nRange(&#8220;bonus_amt&#8221;).Value = 0<br \/>\nEnd If<\/p>\n<p>Range(&#8220;us8c&#8221;).Value = &#8220;0&#8221;<br \/>\nRange(&#8220;medis&#8221;).Value = &#8220;0&#8221;<br \/>\nRange(&#8220;medps&#8221;).Value = &#8220;0&#8221;<br \/>\nRange(&#8220;usE&#8221;).Value = &#8220;0&#8221;<br \/>\nRange(&#8220;usU&#8221;).Value = &#8220;0&#8221;<br \/>\nRange(&#8220;usdd&#8221;).Value = &#8220;0&#8221;<br \/>\nRange(&#8220;usddb&#8221;).Value = &#8220;0&#8221;<br \/>\nRange(&#8220;usccd&#8221;).Value = &#8220;0&#8221;<\/p>\n<p>Range(&#8220;Renta&#8221;).Value = &#8220;0&#8221;<br \/>\nRange(&#8220;ptax&#8221;).Value = &#8220;0&#8221;<br \/>\nRange(&#8220;prv_sal&#8221;).Value = &#8220;0&#8221;<br \/>\nRange(&#8220;inc_other&#8221;).Value = &#8220;0&#8221;<br \/>\nRange(&#8220;Deducted_tax&#8221;).Value = &#8220;0&#8221;<\/p>\n<p>Range(&#8220;medbill&#8221;).Formula = &#8220;=C14&#8221;<br \/>\nRange(&#8220;medbill&#8221;).Select<br \/>\nSelection.Copy<br \/>\nRange(&#8220;billsamt&#8221;).Select<br \/>\nActiveSheet.Paste<br \/>\nApplication.CutCopyMode = False<br \/>\nRange(&#8220;medbill&#8221;).Select<\/p>\n<p>Range(&#8220;Emp_name&#8221;).Value = &#8220;&#8221;<br \/>\nRange(&#8220;DSG_name&#8221;).Value = &#8220;&#8221;<\/p>\n<p>On Error Resume Next<\/p>\n<p>Sheets(&#8220;Tax Computation &amp; CTC Structure&#8221;).Protect Password:=&#8221;password&#8221;<br \/>\nApplication.ScreenUpdating = False<br \/>\nEnd Sub<\/p>\n<p>Sub Missmatch()<br \/>\nOn Error Resume Next<br \/>\nApplication.ScreenUpdating = False<br \/>\nSheets(&#8220;Tax Computation &amp; CTC Structure&#8221;).Unprotect Password:=&#8221;password&#8221;<br \/>\nRange(&#8220;Spl_all&#8221;).Select<br \/>\nSelectionvalue = 0<br \/>\nRange(&#8220;diffrence&#8221;).Select<br \/>\nSelection.Copy<br \/>\nRange(&#8220;Spl_all&#8221;).Select<br \/>\nSelection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, SkipBlanks _<br \/>\n:=False, Transpose:=False<br \/>\nSelection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, SkipBlanks _<br \/>\n:=False, Transpose:=False<br \/>\nSelection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, SkipBlanks _<br \/>\n:=False, Transpose:=False<br \/>\nSelection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, SkipBlanks _<br \/>\n:=False, Transpose:=False<br \/>\nSelection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, SkipBlanks _<br \/>\n:=False, Transpose:=False<br \/>\nApplication.CutCopyMode = False<br \/>\nSheets(&#8220;Tax Computation &amp; CTC Structure&#8221;).Protect Password:=&#8221;password&#8221;<br \/>\nOn Error Resume Next<br \/>\nApplication.ScreenUpdating = False<br \/>\nEnd Sub<\/p>\n<p>Sub PrintSheet()<br \/>\nApplication.ScreenUpdating = False<br \/>\nDim f As Integer, t As Integer, Message, Ans<br \/>\nApplication.ScreenUpdating = False<\/p>\n<p>If Range(&#8220;Emp_name&#8221;).Value = &#8220;&#8221; Then<br \/>\nRange(&#8220;Emp_name&#8221;).Select<br \/>\nMsgBox (&#8220;Employee Name Shoud not be Blank&#8221;)<br \/>\nExit Sub<br \/>\nEnd If<\/p>\n<p>If Range(&#8220;DSG_name&#8221;).Value = &#8220;&#8221; Then<br \/>\nRange(&#8220;DSG_name&#8221;).Select<br \/>\nMsgBox (&#8220;Employee Designation Shoud not be Blank&#8221;)<br \/>\nExit Sub<br \/>\nEnd If<\/p>\n<p>If Range(&#8220;Annual_CTC&#8221;).Value &lt; 1 Then<br \/>\nRange(&#8220;Annual_CTC&#8221;).Select<br \/>\nMsgBox (&#8220;Annual_CTC is not Correct&#8221;)<br \/>\nExit Sub<br \/>\nEnd If<\/p>\n<p>If Range(&#8220;Spl_all&#8221;).Value &lt; 1 Then<br \/>\nRange(&#8220;Spl_all&#8221;).Select<br \/>\nMsgBox (&#8220;CTC Structure values are not Correct&#8221;)<br \/>\nExit Sub<br \/>\nEnd If<\/p>\n<p>Application.ScreenUpdating = False<\/p>\n<p>Ans = MsgBox(&#8220;Are you sure want to Print ?&#8221;, vbYesNo + vbExclamation, &#8220;Confirmation &#8211; Yes No&#8221;)<br \/>\nIf Ans = vbNo Then<br \/>\nExit Sub<br \/>\nEnd If<br \/>\nActiveSheet.PrintOut<\/p>\n<p>Application.ScreenUpdating = False<\/p>\n<p>End Sub<\/p>\n<hr>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Below we will look at a program in Excel VBA that calculates the tax on an income. The following tax rates apply to individuals who are residents of India. &nbsp; Download the&nbsp;Indian Salary tax computation in excel vba. Tax Computation &amp; CTC Structure 2015-16 &nbsp; &nbsp; Code&nbsp;in open sheet Private Sub Workbook_Open() Application.ScreenUpdating = False &#8230; <a title=\"India Salary tax computation in excel vba\" class=\"read-more\" href=\"https:\/\/99excel.com\/home\/india-salary-tax-computation-in-excel-vba\/\" aria-label=\"More on India Salary tax computation in excel vba\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-257","post","type-post","status-publish","format-standard","hentry"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/posts\/257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/comments?post=257"}],"version-history":[{"count":1,"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/posts\/257\/revisions"}],"predecessor-version":[{"id":870,"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/posts\/257\/revisions\/870"}],"wp:attachment":[{"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/media?parent=257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/categories?post=257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/tags?post=257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}