+ Reply to Thread
Results 1 to 2 of 2

Compile Error : Ambiguous name detected

Hybrid View

  1. #1
    Registered User
    Join Date
    10-17-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    1

    Post Compile Error : Ambiguous name detected

    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.TextThen  '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.TextThen '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.TextThen '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(161).Value Me.Totaltax 'set col w
    ActiveCell.Offset(1, 0).Value = Me.Totaltax '
    set col w
    ActiveCell
    .Offset(20).Value Me.vasgrsval 'set col w
    End Sub
    [/CODE][/HTML] 
    Thanks, Vasanth

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Compile Error : Ambiguous name detected

    In the top of declaration you have declared this variable Public vasgrsval As Integer twice. Just delete any of the one from your code...


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA Compile Error: Ambiguous name detected
    By kieranoduill in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-08-2013, 05:31 PM
  2. [SOLVED] compile error ambiguous name detected!?
    By Margate in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-24-2013, 08:49 PM
  3. [SOLVED] compile error ambiguous name detected
    By truman40 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-24-2010, 08:36 AM
  4. Compile error: Ambiguous name detected
    By Aletha in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-05-2008, 05:48 PM
  5. Compile Error: Ambiguous Name Detected: Workbook_Open
    By Gos-C in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-19-2008, 10:46 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1