invalid qualifier error in VBA

rharn

Board Regular
Joined
Jun 21, 2011
Messages
54
Hello,

I am currently writing a section of a code that will display the results of a search function from an array. However, I keep encountering an 'invalid qualifier' error. Can someone please let me know why it keeps doing this?

Code:
Dim Results1() as Variant
Dim i1 as Integer
Dim NextRow as Integer

        For i1 = LBound(Results1) To UBound(Results1)
            Results1(i1).EntireRow.Copy
            Worksheets("searchresults").Select
            NextRow = Range("D65536").End(xlUp).Row + 1
            Cells(NextRow, 1).Select
            ActiveSheet.Paste
        Next il1
 
Since the code itself contains a lot of if/then statements and a lot of repetition I will only post one section of the code for now as the rest of it is pretty much a repetition of the it. HOwever, if the problem still can't be figured out I can post the entire code then.

Code:
Sub Search()

    'Renaming sheet1 as "search result"
    Sheet1.Activate
    Sheet1.Name = "SearchResult"
      
    'Clearing all sheet contents
    Cells.Select
    Selection.ClearContents
    ActiveCell.Cells.Select
    
    Worksheets("Properties").Select
    Range("D6").EntireRow.Select
    Selection.Copy
    
    Worksheets("SearchResult").Select
    Range("A1").Select
    ActiveCell.PasteSpecial _
                Paste:=xlPasteValues

    Dim TextBox1 As Long
    Dim Results1() As Variant
    Dim R1 As Integer
    Dim FindRange1 As Range
    Dim Find1 As Range
    Dim NextRow As Long
    Dim Max As Integer
    Dim i1 As Long
    Max = 100

    TextBox1 = ILsearch.TextBox1.Value

            Set FindRange1 = Worksheets("Properties").Range("P7:P1000")
                If ILsearch.P1B1.Value = True Then
                    For i1 = 0 To Max
                        For Each Find1 In FindRange1
                            If (Find1.Value < TextBox1) And (Find1.Value > 0) Then
                                i1 = i1 + 1
                                ReDim Preserve Results1(i1)
                                Results1(i1) = Find1.Address
                            End If
                        Next Find1
                    Next i1
                End If

    Dim rvalue As Variant
    Dim p1results As Range

        For i1 = LBound(Results1) To UBound(Results1)
            Set p1results = Range(Results1(i1))
            p1results.EntireRow.Copy
            With Worksheets("SearchResult").Select
                NextRow = Range("D65536").End(xlUp).Row + 1
                Cells(NextRow, 1).Select
                ActiveSheet.Paste
            End With
        Next i1
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,224,524
Messages
6,179,310
Members
452,906
Latest member
phanmemchatdakenhupviral

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