Hi all,
I don't know Excel VBA but still i am forced to write the script for a small task. I am writing this by referring books. I am facing compile error Ambiguous name detected. Please find my code as below : I am getting compile error in vasgrsval variable. Requesting you to help me on this regards.
PHP Code:
[HTML] [CODE] Public Taxvalue As Integer
Public vasgrsval As Integer
Public Edst As Integer
Public cstvattax
Public Totaltax As Integer
Public vasgrsval As Integer
Const Edsttaxrate As Double = 0.12
Const domtimptaxrate As Double = 0.1
Private Sub calculate_Click()
If Not IsNumeric(Me.Netvalue.Text) Then 'Net Value
MsgBox "Please enter Net Value (numeric value) :", vbExclamation
Me.Netvalue.SetFocus 'position cursor to try again
Exit Sub 'terminate here - why continue?
End If
If Me.ComboGoodsservice.Text = "" Then 'Good Service
MsgBox "Please choose Goods Service :", vbExclamation
Me.ComboGoodsservice.SetFocus 'position cursor to try again
Exit Sub 'terminate here - why continue?
End If
Select Case ComboGoodsservice
Case "G"
If Me.ComboCSTVAT.Text = "" Then 'CST VAT
MsgBox "Please choose CST/VAT :", vbExclamation
Me.ComboCSTVAT.SetFocus 'position cursor to try again
Exit Sub 'terminate here - why continue?
End If
If Me.ComboTaxType.Text = "" Then 'Tax Type
MsgBox "Please choose Tax Type :", vbExclamation
Me.ComboTaxType.SetFocus 'position cursor to try again
Exit Sub 'terminate here - why continue?
End If
If Me.ComboLineType.Text = "" Then 'Line Type
MsgBox "Please choose Line Type :", vbExclamation
Me.ComboLineType.SetFocus 'position cursor to try again
Exit Sub 'terminate here - why continue?
End If
If Not IsNumeric(Me.TotalTAValue.Text) Then 'TotalTAValue
MsgBox "Please enter Total TA Value :", vbExclamation
Me.TotalTAValue.SetFocus 'position cursor to try again
Exit Sub 'terminate here - why continue?
End If
If Not IsNumeric(Me.TotalChildValue.Text) Then 'Total child Value
MsgBox "Please enter Total Child Value :", vbExclamation
Me.TotalChildValue.SetFocus 'position cursor to try again
Exit Sub 'terminate here - why continue?
End If
Case "S"
If Me.DomImp.Text = "" Then 'Line Type
MsgBox "Please choose Domestic or Import :", vbExclamation
Me.DomImp.SetFocus 'position cursor to try again
Exit Sub 'terminate here - why continue?
End If
If Not IsNumeric(Me.TotalTAValue.Text) Then 'TotalTAValue
MsgBox "Please enter Total TA Value :", vbExclamation
Me.TotalTAValue.SetFocus 'position cursor to try again
Exit Sub 'terminate here - why continue?
End If
If Not IsNumeric(Me.TotalChildValue.Text) Then 'Total child Value
MsgBox "Please enter Total Child Value :", vbExclamation
Me.TotalChildValue.SetFocus 'position cursor to try again
Exit Sub 'terminate here - why continue?
End If
Case Else
MsgBox ("Please choose Good Service")
End Select
Select Case ComboGoodsservice
Case "G"
Select Case ComboLineType
Case " ", "W"
MsgBox ("Good service G and line type is blank or W")
Select Case ComboCSTVAT
Case "C"
MsgBox ("Good service G and line type is blank or W and it is CST")
cstvattax = cstvat * cstvattaxrate
Totaltax = (Edsttax + Ecesstax + Shecesstax + cstvattax)
vasgrsval = Netvalue + Totaltax
Case "V"
Select Case ComboTaxType
Case "M"
MsgBox ("Good service G and line type is blank or W and VAT is M")
Totaltax = (Edsttax + Ecesstax + Shecesstax + cstvattax)
vasgrsval = Netvalue + Totaltax
Case "N"
MsgBox ("Good service G and line type is blank or W and VAT is N")
Totaltax = (Edsttax + Ecesstax + Shecesstax + cstvattax)
vasgrsval = Netvalue + Totaltax
Case Else
MsgBox ("Blank or W Tax Type Invalid")
End Select
Case Else
MsgBox ("CST or VAT Not valid")
End Select
Case "F"
MsgBox ("Good service G and line type is F")
Select Case ComboCSTVAT
Case "C"
MsgBox ("Good service G and line type is F and it is CST")
Totaltax = (Edsttax + Ecesstax + Shecesstax + cstvattax)
vasgrsval = ((Netvalue + Totaltax) - TotalChildValue)
Case "V"
Select Case ComboTaxType
Case "M"
MsgBox ("Good service G and line type is F and VAT is M")
Totaltax = (Edsttax + Ecesstax + Shecesstax + cstvattax)
vasgrsval = ((Netvalue + Totaltax) - TotalChildValue)
Case "N"
MsgBox ("Good service G and line type is F and VAT is N")
Totaltax = (Edsttax + Ecesstax + Shecesstax + cstvattax)
vasgrsval = ((Netvalue + Totaltax) - TotalChildValue)
Case Else
MsgBox ("F - Tax Type Invalid")
End Select
Case Else
MsgBox ("F - CST or VAT Not valid")
End Select
Case "S"
MsgBox ("Good service G and line type is S")
Select Case ComboCSTVAT
Case "C"
MsgBox ("Good service G and line type is S and it is CST")
Totaltax = (Edsttax + Ecesstax + Shecesstax + cstvattax)
vasgrsval = ((Netvalue + Totaltax) - TotalChildValue)
Case "V"
Select Case ComboTaxType
Case "M"
MsgBox ("Good service G and line type is S and VAT is M")
vasgrsval = ((Netvalue + Totaltax) - TotalChildValue)
Case "N"
MsgBox ("Good service G and line type is S and VAT is N")
Totaltax = (Edsttax + Ecesstax + Shecesstax + cstvattax)
vasgrsval = ((Netvalue + Totaltax) - TotalChildValue)
Case Else
MsgBox ("S -Tax Type Invalid")
End Select
Case Else
MsgBox ("S - CST or VAT Not valid")
End Select
Case "T"
MsgBox ("Good service G and line type is T")
Select Case ComboCSTVAT
Case "C"
MsgBox ("Good service G and line type is T and it is CST")
Totaltax = (Edsttax + Ecesstax + Shecesstax + cstvattax)
vasgrsval = ((Netvalue + Totaltax) - TotalChildValue)
Case "V"
Select Case ComboTaxType
Case "M"
MsgBox ("Good service G and line type is T and VAT is M")
Totaltax = (Edsttax + Ecesstax + Shecesstax + cstvattax)
vasgrsval = ((Netvalue + Totaltax) - TotalChildValue)
Case "N"
MsgBox ("Good service G and line type is T and VAT is N")
Totaltax = (Edsttax + Ecesstax + Shecesstax + cstvattax)
vasgrsval = ((Netvalue + Totaltax) - TotalChildValue)
Case Else
MsgBox ("Tax Type Invalid")
End Select
Case Else
MsgBox ("T - CST or VAT Not valid")
End Select
Case Else
MsgBox ("G -Line type not valid")
End Select
Case "S"
MsgBox ("Calculation for Domestic or import")
Select Case DomImp
Case "D"
Totaltax = (Edsttax + Ecesstax + Shecesstax)
vasgrsval = ((Netvalue + Totaltax) - TotalChildValue)
Case "I"
MsgBox ("Service Transaction and Type Domestic")
Totaltax = (Edsttax + Ecesstax + Shecesstax)
vasgrsval = ((Netvalue + Totaltax) - TotalChildValue)
Case Else
MsgBox ("Select Domestic or Imports")
End Select
Case Else
MsgBox ("enter G or S")
End Select
ActiveCell.Offset(16, 1).Value = Me.Totaltax 'set col w
ActiveCell.Offset(1, 0).Value = Me.Totaltax 'set col w
ActiveCell.Offset(2, 0).Value = Me.vasgrsval 'set col w
End Sub
[/CODE][/HTML]
Bookmarks