VBA error: Ambiguous name detected: GetCMCS

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,347
Office Version
  1. 365
Platform
  1. Windows
I have 5 macro's (not sure if thats the technically correct word to use) that I am trying to run all of them from one button.

So I created this:

Code:
Sub Import_PP_Report()

RemoveTab

GetCMCS

ClearMakeTable

AddTitleFormulas

Refresh_All_tables

End Sub

If I run these individually they work with no issues, but when I combined them (see above) I get the ambiguous error message. Any help is appreciated.

here is the one macro that it doesnt like when its combined with the other. But stand-alone it works fine

Code:
Sub GetCMCS()

    Dim ProposalReports As Workbook
    Dim CMCS As Variant

    Set ProposalReports = ThisWorkbook

    CMCS = Application.GetOpenFilename("Excel files (*.xls*), *.xls*")
    
    If CMCS <> False Then
        Workbooks.Open (CMCS)
        Set CMCS = ActiveWorkbook
        
        If Evaluate("isref('Material Ad Hoc'!A1)") Then
            Sheets("Material Ad Hoc").Select
            Sheets("Material Ad Hoc").Copy Before:=ThisWorkbook.Sheets(2)
            
                Sheets("Material Ad Hoc").Select
                     With ActiveWorkbook.Sheets("Material Ad Hoc").Tab
                        .Color = 12611584
                        .TintAndShade = 0
                    End With
        Else
                MsgBox "The Selected Workbook does not contain a Material Ad Hoc tab, check to validate the tab is named correctly or select a different Workbook"
             Exit Sub
        End If
    
    End If


End Sub
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
That usually means that you have two different procedures named "GetCMCS" in your workbook.
Check all your VBA modules (including the Sheet and ThisWorkbook modules), and make sure that you do not have a second copy of the "GetCMCS" procedure in there.
 
Upvote 0
Solution
Thank you both. That was it. I was trying to organize the Modules and forgot to delete the original.

Thank You!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,099
Messages
6,170,108
Members
452,302
Latest member
TaMere

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top