+ Reply to Thread
Results 1 to 15 of 15

Shorten Runtime & Modify Output of Search Macro

Hybrid View

PKW57 Shorten Runtime & Modify... 09-04-2015, 03:44 PM
TMS Re: Shorten Runtime & Modify... 09-04-2015, 04:34 PM
PKW57 Re: Shorten Runtime & Modify... 09-08-2015, 10:11 AM
stnkynts Re: Shorten Runtime & Modify... 09-04-2015, 05:52 PM
PKW57 Re: Shorten Runtime & Modify... 09-08-2015, 10:11 AM
LJMetzger Re: Shorten Runtime & Modify... 09-05-2015, 05:20 PM
PKW57 Re: Shorten Runtime & Modify... 09-08-2015, 10:44 AM
TMS Re: Shorten Runtime & Modify... 09-08-2015, 11:19 AM
TMS Re: Shorten Runtime & Modify... 09-08-2015, 10:28 AM
TMS Re: Shorten Runtime & Modify... 09-08-2015, 11:13 AM
PKW57 Re: Shorten Runtime & Modify... 09-08-2015, 11:43 AM
PKW57 Re: Shorten Runtime & Modify... 09-10-2015, 03:33 PM
PKW57 Re: Shorten Runtime & Modify... 09-10-2015, 03:45 PM
LJMetzger Re: Shorten Runtime & Modify... 09-10-2015, 05:02 PM
PKW57 Re: Shorten Runtime & Modify... 09-11-2015, 09:37 AM
  1. #1
    Registered User
    Join Date
    07-28-2015
    Location
    Danville, IL USA
    MS-Off Ver
    2013
    Posts
    34

    Shorten Runtime & Modify Output of Search Macro

    Greetings,

    Running Office 2007, 2010, & 2013 on Windows 7 in our network environment here.

    I have a search macro that looks at all worksheets in the workbook except for one that will never contain the string being searched for. The results get displayed in a message box. This workbook will be used by many people who will access it over our internal network.

    Although the macro functions, I'm having some issues with it.

    First, the macro produces no error code and the results message box pops up rather quickly but it looks like the macro never stops running. My cursor stays in "busy" mode unless it is over the results message box. I suspect this is because the results message box is waiting for the click on the OK button. I'm afraid this will confuse the end users. Is there any way to force the cursor back to its default pointer?

    Second, the results message box give the locations of the found strings in absolute references (with the dollar signs). My manager thinks this is "ugly". How can I get rid of the dollar signs?

    Third, my manager would like it if the locations in the results message box could be hyperlinks to the actual cell listed. Is this even possible from a message box? [My manager frequently asks for the impossible. ]


    Here's an image of the results with the cursor spinning:
    Search-n-Cursor.JPG

    Here is my code:
    Public Sub Global_Search()
    'Search all worksheets and output a message box with all the found data addresses.
        Dim ws As Worksheet, Found As Range
        Dim myText As String, FirstAddress As String
        Dim AddressStr As String, foundNum As Integer
    
        myText = InputBox("Enter text to find")
    
        If myText = "" Then Exit Sub
    
        For Each ws In ThisWorkbook.Worksheets
        With ws
        If ws.Name = "Navigation Instructions" Then GoTo myNext
    
        Set Found = .UsedRange.Find(what:=myText, LookIn:=xlValues, LookAt:=xlPart, MatchCase:=False)
    
        If Not Found Is Nothing Then
        FirstAddress = Found.Address
    
        Do
        foundNum = foundNum + 1
        AddressStr = AddressStr & .Name & " " & Found.Address & vbCrLf
    
        Set Found = .UsedRange.FindNext(Found)
        
        Loop While Not Found Is Nothing And Found.Address <> FirstAddress
        End If
    
    myNext:
        End With
    
        Next ws
    
        If Len(AddressStr) Then
        MsgBox "Found: """ & myText & """ " & foundNum & " times." & vbCr & _
        AddressStr, vbOKOnly, myText & " found in these cells"
        Else:
    
        MsgBox "Unable to find " & myText & " in this workbook.", vbExclamation
        End If
    End Sub
    I'm a novice at VBA, only half-way through my online Introduction to VBA course. I find lots of code via google and then modify it to meet my needs.

    Any assistance would be greatly appreciated.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,079

    Re: Shorten Runtime & Modify Output of Search Macro

    What would you have us test your code with?

    Third, my manager would like it if the locations in the results message box could be hyperlinks to the actual cell listed. Is this even possible from a message box?
    Not AFAIAA. I believe that you could do something similar wit a UserForm emulating a MsgBox. Suggest you Google: excel vba hyperlink in msgbox for some suggested approaches.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    07-28-2015
    Location
    Danville, IL USA
    MS-Off Ver
    2013
    Posts
    34

    Re: Shorten Runtime & Modify Output of Search Macro

    Thanks you.

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Shorten Runtime & Modify Output of Search Macro

    I agree with TMS, you would probably have to do it with a UserForm. You could probably set it up to create a label for each of your outputs and then apply a hyperlink to each label on click. Not easy stuff to do either.
    If you are happy with my response please click the * in the lower left of my post.

  5. #5
    Registered User
    Join Date
    07-28-2015
    Location
    Danville, IL USA
    MS-Off Ver
    2013
    Posts
    34

    Re: Shorten Runtime & Modify Output of Search Macro

    Thank you.

  6. #6
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Shorten Runtime & Modify Output of Search Macro

    Hi PKW57,

    My cursor stays in "busy" mode unless it is over the results message box. I suspect this is because the results message box is waiting for the click on the OK button. I'm afraid this will confuse the end users. Is there any way to force the cursor back to its default pointer?
    It can probably be done with some fancy footwork, but is not recommended. An alternate approach such as a custom UserForm as previously suggested is the way to go.

    Second, the results message box give the locations of the found strings in absolute references (with the dollar signs). My manager thinks this is "ugly". How can I get rid of the dollar signs?
    I hate the '$' signs too. They are easy to remove.
    Sub DisplayOrHideDollarSigns()
      'Output Sample text in Immediate Window (CTRL G in Debugger)
    
      Debug.Print Range("A1").Address               'Outputs $A$1
      Debug.Print Range("A1").Address(True, True)   'Outputs $A$1
      Debug.Print Range("A1").Address(True, False)  'Outputs A$1
      Debug.Print Range("A1").Address(False, True)  'Outputs $A1
      Debug.Print Range("A1").Address(False, False) 'Outputs A1
      
      'NOTE: First   True/False value is for ROW
      '      Seconds True/False value is for COLUMN
    
    End Sub
    my manager would like it if the locations in the results message box could be hyperlinks to the actual cell listed. Is this even possible from a message box?
    See the attached file that uses a UserForm with the code that follows. This should get you started with what you want. It is implemented as follows. The User:
    a. Opens a UserForm by Clicking a CommandButton. The UserForm can be opened in several different ways, but I find the CommandButton approach to usually be the most convenient.
    b. Fills in a TextBox with the item to be searched for (similar to your InputBox).
    c. Selects 'Search'
    d. A 'ListBox' in the UserForm is populated with the search results.
    e. 'Double Clicks' a line in the list box to go to that cell (similar to Hyperlink).

    UserForm1 module code:
    Option Explicit
    
    Private Sub UserForm_Initialize()
    
      With LabelStatus
        .Font.Name = "Arial"
        .Font.Size = 10
        .Font.Bold = True
     
        .ForeColor = vbBlue                'Font Color
        .Caption = "Put text to find in the 'TextBox' and select 'Search'."
      End With
    
      With TextBox1
        .Font.Name = "Arial"
        .Font.Size = 12
        .Font.Bold = True
     
        .ForeColor = vbBlue                'Font Color
      End With
    
      With OptionButtonExactMatch
        .Font.Name = "Arial"
        .Font.Size = 8
        .Font.Bold = True
     
        .ForeColor = vbBlack               'Font Color
      End With
    
      With OptionButtonPartialMatch
        .Font.Name = "Arial"
        .Font.Size = 8
        .Font.Bold = True
     
        .ForeColor = vbBlack               'Font Color
      End With
    
      With ListBox1
        .Font.Name = "Arial"
        .Font.Size = 10
        .Font.Bold = True
     
        .ForeColor = vbBlack
      End With
      
      'Initialize the 'TextBox' Tag value
      TextBox1.Tag = ""
    
    End Sub
    
    Private Sub TextBox1_Change()
      'This processes CHANGES in TextBox1
      
      Dim sValue As String
      
      'Get the TextBox value (with leading/trailing spaces removed)
      sValue = Trim(TextBox1.Value)
    
      'Make the 'Search' CommandButton Visible only if the TextBox value has changed.
      If sValue = TextBox1.Tag Then
        CommandButtonSearch.Visible = False
      Else
        CommandButtonSearch.Visible = True
      End If
    
    End Sub
    
    Private Sub CommandButtonSearch_Click()
      'This searches for matches to the value in TextBox1 and puts the results in 'ListBox1'
      Call SearchAndDisplayResultsInUserForm1ListBox1
    End Sub
    
    Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
      'This puts the focus on the 'Sheet' and 'Cell' that are on the line that was 'Double Clicked'
    
      Dim iListBoxRow As Long
      Dim sCellAddress As String
      Dim sSheetName As String
      
      'Get the ListBox Row selected
      'Get the 'Sheet Name' and the 'Cell Address'
      iListBoxRow = UserForm1.ListBox1.ListIndex
      sSheetName = UserForm1.ListBox1.List(iListBoxRow, 1)
      sCellAddress = UserForm1.ListBox1.List(iListBoxRow, 3)
      
      'Put the focus on the 'Sheet' and 'Cell Address' selected
      ThisWorkbook.sheets(sSheetName).Select
      ThisWorkbook.sheets(sSheetName).Range(sCellAddress).Select
      
      'Close the UserForm
      Unload Me
      
    End Sub
    Ordinary Code module code (such as Module1):
    Option Explicit
    
    Sub DisplayModalUserForm1()
      'Modal    UserForm locks out all Excel Access (vbModal)
      'Modeless UserForm allows access to Excel Resources while UserForm is active (vbModeless)
      UserForm1.Show vbModal
    End Sub
    
    Sub DisplayModelessUserForm1()
      'Modal    UserForm locks out all Excel Access (vbModal)
      'Modeless UserForm allows access to Excel Resources while UserForm is active (vbModeless)
      UserForm1.Show vbModeless
    End Sub
    
    Public Function SearchAndDisplayResultsInUserForm1ListBox1()
      'Search all worksheets and output a message box with all the found data addresses
      '
      'The ListBox Column Assignments (First Column is Column 0):
      '0 = 'Sheet'
      '1 = Sheet Name
      '2 = 'Cell'
      '3 = Cell Address
      '
      'NOTE: This is a function to remove it from the List of Macros that can be called directly from Excel (ALT F8)
      
      Dim ws As Worksheet
      
      Dim r As Range
      
      Dim iFoundCount As Long
      Dim iListBoxRow As Long
      
      Dim bProcessThisSheet As Boolean
      Dim bExactMatchRequired As Boolean
      
      Dim sAddress As String
      Dim sMatchTypeRequired As String
      Dim sSheetName As String
      Dim sSearchString As String
      Dim sFirstAddress As String
      Dim sConcatenation As String
      Dim sMessage As String
    
      'Get the 'Search String' from the UserForm (with leading/trailing spaces removed)
      sSearchString = Trim(UserForm1.TextBox1.Value)
    
      'Clear the contents of the ListBox
      UserForm1.ListBox1.Clear
      
      'Determine if an Exact Match is required or if a Partial Match is OK
      bExactMatchRequired = UserForm1.OptionButtonExactMatch.Value
      
      'Initialize the ListBox Row Number
      iListBoxRow = -1
      
      'Exit if the Search String is BLANK
      If Len(sSearchString) = 0 Then
        Exit Function
      End If
    
      'Search each Sheet in the Workbook (unless the sheet is to be IGNORED)
      For Each ws In ThisWorkbook.Worksheets
      
        'Get the Current Sheet Name
        sSheetName = ws.Name
        
        'Determine if this Sheet is to be Processed
        Select Case sSheetName
        
          Case "Navigation Instructions"
            bProcessThisSheet = False
          
          Case Else
            bProcessThisSheet = True
        
        End Select
        
        
        If bProcessThisSheet = True Then
        
          'Find the first match on the Sheet
          If bExactMatchRequired = True Then
            sMatchTypeRequired = " (COMPLETE EXACT Match Required)"
            Set r = ws.UsedRange.Find(what:=sSearchString, LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=False)
          Else
            sMatchTypeRequired = " (Partial Match Acceptable)"
            Set r = ws.UsedRange.Find(what:=sSearchString, LookIn:=xlValues, LookAt:=xlPart, MatchCase:=False)
          End If
    
          'Continue processing only if the First Match was found
          If Not r Is Nothing Then
            sFirstAddress = r.Address(False, False) '(False, False) removes BOTH '$ signs from the address
            sAddress = sFirstAddress
    
            Do
              'Increment the 'Found' Count
              iFoundCount = iFoundCount + 1
              
              'Increment the ListBox row number
              iListBoxRow = iListBoxRow + 1
        
              'Add the next row to the ListBox
              UserForm1.ListBox1.AddItem
              UserForm1.ListBox1.List(iListBoxRow, 0) = "Sheet"
              UserForm1.ListBox1.List(iListBoxRow, 1) = sSheetName
              UserForm1.ListBox1.List(iListBoxRow, 2) = "Cell"
              UserForm1.ListBox1.List(iListBoxRow, 3) = sAddress
              
              'Look for the 'Next' Match
              'Exit if there is NO MATCH (should never occur) or when the First Address repeats
              Set r = ws.UsedRange.FindNext(r)
              sAddress = r.Address(False, False)
        
            Loop While Not r Is Nothing And sAddress <> sFirstAddress
            
          End If
        
        End If
    
      Next ws
    
      'Display a message in the UserForm Status Label
      If iFoundCount = 0 Then
        sMessage = "Unable to find " & sSearchString & " in this workbook" & sMatchTypeRequired & "." & vbCrLf & _
                   "To search AGAIN, Put text to find in the 'TextBox' and select 'Search'."""
      Else
        sMessage = "Found '" & sSearchString & "' " & iFoundCount & " times" & sMatchTypeRequired & "." & vbCrLf & _
                   "'Double Click' a line in the 'ListBox' to go to that Cell, or " & vbCrLf & _
                   "To search AGAIN, Put text to find in the 'TextBox' and Select 'Search'."
      
      End If
      UserForm1.LabelStatus.Caption = sMessage
      
    End Function
    There are two ways to implement a UserForm:
    a. Modal - Locks out Excel except for the UserForm.
    b. Modeless - Allows access to Excel Resources.

    Lewis

  7. #7
    Registered User
    Join Date
    07-28-2015
    Location
    Danville, IL USA
    MS-Off Ver
    2013
    Posts
    34

    Re: Shorten Runtime & Modify Output of Search Macro

    LJMetzger,

    Thank you for your detailed response. Good grief, how many years will it take me to understand all of this stuff?!

    If I take your code and paste it into my workbook, I get the following error in the Form:

    Compile Error.JPG

    Correct me if I'm wrong but, I think this has something to do with the
    Option Explicit
    statement?

    The sample file you attached to your response however runs just fine.

    If I comment out the
    Option Explicit
    statement in either or both the Form and the Module, I get this Runtime Error 424 error:

    Runtime Error.JPG

    I saw that your test worksheets all had
    Option Explicit
    in them so I added it to all of my other Procedures and Modules. This broke a lot of my other VBA and made no difference in the way your code ran within my workbook.

    I am attaching my workbook for reference. There is quite a bit of code involved and I'm positive there are more elegant ways of doing things but I'm piecing it together from google searches, a VBA reference book, and help from the forums like this one. The attached file is my most current functional revision and has none of the changes I have attempted in my effort to create a global search function.

    150903 QA-RF-1012 QMS Document Map.xlsm

    Thanks again for your time and patience. It is truly appreciated.

    ~ Phil

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,079

    Re: Shorten Runtime & Modify Output of Search Macro

    Your sample workbook doesn't have all the code it needs, specifically, the Global Search Macro. It also doesn't have a form or form code present.

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,079

    Re: Shorten Runtime & Modify Output of Search Macro

    You're welcome. Thanks for the rep.

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,079

    Re: Shorten Runtime & Modify Output of Search Macro

    Option Explicit just forces you to declare/define all your variables. This helps to avoid simple coding errors caused by mi-spelling variable names. It can also make the code more efficient as it is useful to actually define the variable type. Some variable types will take up more space than others and some actions will cause a variable to be coerced from one type to another.

    So, for example:
    Dim sStringVar
    will define the variable and will prevent
    Option Explicit
    from complaining, but:
    Dim sStringVar As String
    is better.

    The presence or absence of Option Explicit should not cause an error. The absence will allow potential compilation errors not to be picked up early in development. Its presence will stop some of the trivial errors but, even if the code compiles, it doesn't guarantee that it will run. However, run time errors can just as easily be cause by the presence or absence of the data that you expect. For example, if you use .SpecialCells(xlCellTypeBlanks) to select blank cells and there aren't any, it will cause a run time error.

    Regards, TMS

  11. #11
    Registered User
    Join Date
    07-28-2015
    Location
    Danville, IL USA
    MS-Off Ver
    2013
    Posts
    34

    Re: Shorten Runtime & Modify Output of Search Macro

    Yes, the file I attached was my last functional revision.

    Here is the version I modified this morning and ran into problems with.

    150908 QA-RF-1012 QMS Document Map.xlsm

  12. #12
    Registered User
    Join Date
    07-28-2015
    Location
    Danville, IL USA
    MS-Off Ver
    2013
    Posts
    34

    Re: Shorten Runtime & Modify Output of Search Macro

    All,

    So I've been beating on this code and I'm still stumped.


    I modified the Form by defining the variables as objects. See below:

    Option Explicit
    
    Private Sub UserForm_Initialize()
        Dim LabelStatus As Object
        Dim TextBox1 As Object
        Dim OptionButtonExactMatch As Object
        Dim OptionButtonPartialMatch As Object
        Dim ListBox1 As Object
        
        
      With LabelStatus
        .Font.Name = "Arial"
        .Font.Size = 10
        .Font.Bold = True
     
        .ForeColor = vbBlue                'Font Color
        .Caption = "Put text to find in the 'TextBox' and select 'Search'."
      End With
    
      With TextBox1
        .Font.Name = "Arial"
        .Font.Size = 12
        .Font.Bold = True
     
        .ForeColor = vbBlue                'Font Color
      End With
    
      With OptionButtonExactMatch
        .Font.Name = "Arial"
        .Font.Size = 8
        .Font.Bold = True
     
        .ForeColor = vbBlack               'Font Color
      End With
    
      With OptionButtonPartialMatch
        .Font.Name = "Arial"
        .Font.Size = 8
        .Font.Bold = True
     
        .ForeColor = vbBlack               'Font Color
      End With
    
      With ListBox1
        .Font.Name = "Arial"
        .Font.Size = 10
        .Font.Bold = True
     
        .ForeColor = vbBlack
      End With
      
      'Initialize the 'TextBox' Tag value
      TextBox1.Tag = ""
    
    End Sub
    
    Private Sub TextBox1_Change()
      'This processes CHANGES in TextBox1
      
      Dim sValue As String
      
      'Get the TextBox value (with leading/trailing spaces removed)
      sValue = Trim(TextBox1.Value)
    
      'Make the 'Search' CommandButton Visible only if the TextBox value has changed.
      If sValue = TextBox1.Tag Then
        CommandButtonSearch.Visible = False
      Else
        CommandButtonSearch.Visible = True
      End If
    
    End Sub
    
    Private Sub CommandButtonSearch_Click()
      'This searches for matches to the value in TextBox1 and puts the results in 'ListBox1'
      Call SearchAndDisplayResultsInUserForm1ListBox1
    End Sub
    
    Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
      'This puts the focus on the 'Sheet' and 'Cell' that are on the line that was 'Double Clicked'
    
      Dim iListBoxRow As Long
      Dim sCellAddress As String
      Dim sSheetName As String
      
      'Get the ListBox Row selected
      'Get the 'Sheet Name' and the 'Cell Address'
      iListBoxRow = UserForm1.ListBox1.ListIndex
      sSheetName = UserForm1.ListBox1.List(iListBoxRow, 1)
      sCellAddress = UserForm1.ListBox1.List(iListBoxRow, 3)
      
      'Put the focus on the 'Sheet' and 'Cell Address' selected
      ThisWorkbook.Sheets(sSheetName).Select
      ThisWorkbook.Sheets(sSheetName).Range(sCellAddress).Select
      
      'Close the UserForm
      Unload Me
      
    End Sub
    Now I get an error message saying "Object variable or With block variable not set." The debugger takes me to the module and indicates the problem occurs at:

    UserForm1.Show vbModal
    However I know the problem is still in the Form because when I open it in the VBA editor all I see is the generic blank form, although if I hit F7 the code I pasted in is there.
    I don't understand what I am supposed to set the variables to! The error message doesn't specify which With statement is causing the issue and some of the variables won't have a value until I enter the search text into the boxes.

  13. #13
    Registered User
    Join Date
    07-28-2015
    Location
    Danville, IL USA
    MS-Off Ver
    2013
    Posts
    34

    Re: Shorten Runtime & Modify Output of Search Macro

    All,

    I just noticed that the sample file sent to me by Mr. Metzger was an Excel 97 - 2003 .xls file.

    I'm running Excel 2013 and my file is saved in the .xlsm format. Could this be the source of the problem? I know there are some differences in VBA from one release of Excel to the next.

    All of my experience with VBA (minuscule as it is) has been using Excel 2013.

  14. #14
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Shorten Runtime & Modify Output of Search Macro

    Trevor - Thank you for helping out.

    PKW57,

    I apologize for not responding sooner to your Sept 8th message, but either ExcelForum never notified that you responded, or I did not notice that I was notified. I assure you that I was not trying to ignore you.

    Either way, see the attached updated copy of your file, that should work correctly as is. I made a couple of small changes to improve the look and feel and to correct a small error. Neither of the changes had anything to do with your problem.

    Your problem was my fault, for not explicitly telling you how to import the code.

    Sometimes you can cut and paste code, such as with an ordinary code module ModUserForm1, or you can export the file (code) from one Workbook, and import the file (code) into another workbook.

    However UserForm modules are different. With UserForm modules you MUST export the file (code) from one Workbook, and import the file (code) into another workbook. This is because UserForms consist of two parts, the UserForm itself, and the UserForm code. You apparently created a blank UserForm1, then copied and pasted the code.

    The error was caused by the BLANK UserForm1 itself, and had nothing to do with .xls or .xlsm, etc.

    Again, please forgive me for the delay.

    Lewis
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    07-28-2015
    Location
    Danville, IL USA
    MS-Off Ver
    2013
    Posts
    34

    Re: Shorten Runtime & Modify Output of Search Macro

    Lewis,

    No apologies necessary. I never complain about free help!

    I was completely unaware of the necessity of importing Forms. I believe I've mentioned that I'm only half way through an online intro to VBA course and I haven't worked with forms yet.

    I have to tell you it was driving me nuts. I saved your sample file as a .xlsm and then ran it side by side with your code copied into my file. Of course your sample file ran just fine but when running it from my file I could see all these undefined variables in the Locals window.

    Lesson learned - import Forms! Thanks for the contribution to my VBA education as well as the assistance with the coding.

    I greatly appreciate your time and patience.

    ~ Phil

+ 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. Word - modify macro to loop search procedure and then extract pages as pdf
    By adamstarr12 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-20-2016, 06:47 AM
  2. [SOLVED] Modify code at runtime
    By chipnputt in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-06-2013, 07:24 PM
  3. [SOLVED] Modify Macro to search columns before rows
    By m3k1rk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-16-2013, 11:51 AM
  4. Modify Macro to Distribute Output Entries into Separated Worksheets
    By Seraph122 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-15-2013, 08:25 PM
  5. Modify Macro Search & Replace Formatting for part of cell
    By tkeiffer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-02-2011, 05:48 PM
  6. Search by more than 2 criteria (help in macro modify)
    By Wiecman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-08-2010, 05:44 AM
  7. Replies: 1
    Last Post: 08-04-2009, 10:43 PM

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