How to retrieve a variable name given its value?

Macro error-"the item with specified name wasnt found"

  • Hi I have a macro that i'm currently modifying. I've finished adding all my parameters. The macro was able to excute properly in the orginal file which it was created in, however when i moved the macro to another file it doesnt seem to process and is giving me the "Item with specified name wasnt found." So if you could please assist me in solving this issue. Would it be useful if i send a version of the file that i've transfered the macro into? Macro is below. xxx--xxx Sub AddNew() 'Update data on Master based on new customer entered on Sheet2 Dim LCIMOutlet As String Dim LClientName As Integer Dim LSAPNumber As String Dim LRegion As String Dim LTerrID As String Dim LTerritoryName As String Dim LEmployeeName As String Dim LBannerName As String Dim LOutletName As String Dim LStore As String Dim LAddress As String Dim LCity As String Dim LProvince As String Dim LPostalCode As String Dim LPhone As String Dim LTypeofCall As String Dim LFrequency As String Dim LCallsPerYear As String Dim LCallTime As String Dim LDrivetime As String Dim LRow As Long Dim LFound As Boolean 'Before adding new customer, make sure a value was entered If IsEmpty(Range("D12").Value) = False Then 'Retrieve new information LCIMOutlet = Range("D12").Value LClientName = Range("D14").Value LSAPNumber = Range("D16").Value LRegion = Range("D18").Value LTerrID = Range("D20").Value LTerritoryName = Range("D22").Value LEmployeeName = Range("D24").Value LBannerName = Range("D26").Value LOutletName = Range("D28").Value LStore = Range("D30").Value LAddress = Range("D32").Value LCity = Range("D34").Value LProvince = Range("D36").Value LPostalCode = Range("D38").Value LPhone = Range("D40").Value LTypeofCall = Range("D42").Value LFrequency = Range("D44").Value LCallsPerYear = Range("D46").Value LCallTime = Range("D48").Value LDrivetime = Range("D50").Value LAdmin = Range("D52").Value 'Move to Master to save the changes Sheets("Master").Select LFound = False LRow = 2 Do While LFound = False 'Encountered a blank CIMOutlet Number (assuming end of list on Master) If IsEmpty(Range("A" & LRow).Value) = True Then LFound = True End If LRow = LRow + 1 Loop Range("A" & LRow - 1).Value = LClientName Range("B" & LRow - 1).Value = LCIMOutlet Range("C" & LRow - 1).Value = LSAP Range("D" & LRow - 1).Value = LRegion Range("E" & LRow - 1).Value = LTerrID Range("F" & LRow - 1).Value = LTerritoryName Range("G" & LRow - 1).Value = LEmployeeName Range("H" & LRow - 1).Value = LBannerName Range("I" & LRow - 1).Value = LOutletName Range("J" & LRow - 1).Value = LStore Range("K" & LRow - 1).Value = LAddress Range("L" & LRow - 1).Value = LCity Range("M" & LRow - 1).Value = LProvince Range("N" & LRow - 1).Value = LPostalCode Range("O" & LRow - 1).Value = LPhoneNumber Range("P" & LRow - 1).Value = LTypeofCall Range("Q" & LRow - 1).Value = LFrequency Range("R" & LRow - 1).Value = LCallsPerYear Range("S" & LRow - 1).Value = LCallTime Range("T" & LRow - 1).Value = LDrivetime Range("U" & LRow - 1).Value = Admin 'Reposition back on Sheet2 Sheets("Sheet2").Select 'Update range for combo boxes ActiveSheet.Shapes("Drop Down 3").Select With Selection .ListFillRange = "Master!$B$2:$B$" & LRow - 1 End With ActiveSheet.Shapes("Drop Down 8").Select With Selection .ListFillRange = "Master!$B$2:$B$" & LRow - 1 End With 'Clear entries from cells Range("D12").Value = "" Range("D14").Value = "" Range("D16").Value = "" Range("D18").Value = "" Range("D20").Value = "" Range("D22").Value = "" Range("D24").Value = "" Range("D26").Value = "" Range("D28").Value = "" Range("D30").Value = "" Range("D32").Value = "" Range("D34").Value = "" Range("D36").Value = "" Range("D38").Value = "" Range("D40").Value = "" Range("D42").Value = "" Range("D44").Value = "" Range("D46").Value = "" Range("D48").Value = "" Range("D50").Value = "" Range("D52").Value = "" Range("D12").Select MsgBox ("New customer was successfully added.") End If End Sub

  • Answer:

    Make sure you have a sheet named "Master", one called "Sheet2", and two dropdowns named Drop Down 8 and Drop Down 3. If you have all these objects, feel free to send me a file at [email protected] and use subject of "AllExpertsQ" and redescribe the problem. It would have helped if you indicated which line was giving you the error.

Miningco.com Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.