Macro Input Box not working

eulerddx4

New Member
Joined
Jul 27, 2014
Messages
16
Hello, I have a spreadsheet that I am trying to finish this morning and for some reason I can't get the Input box to work. My macro scans through code and filters data based on whether it is greater than a number, less than a number or the change between cells to the left of the selected cell is greater than a number.

I have added a couple lines of code to prompt the user to select the active cell but for some reason I am getting error code 424 Object required after I select the active cell.

Your help would be greatly appreciated!


Code:
Sub mypicker()
    Dim rng As Variant
    rng = Application.InputBox("Select the first velocity data point that you would like to filter", Type:=8)
    If rng = False Then Exit Sub
    rownow = rng.Row
    columnnow = rng.Column
    newrow = 9
    newcolumn = 1
    mytime = 0
    While Cells(rownow, columnnow).Value <> ""
        If Cells(rownow, columnnow).Value > 18 Or Cells(rownow, columnnow).Value <= 0 Or Abs(Cells(rownow + 1, columnnow - 1) - Cells(rownow, columnnow - 1)) > 0.2 Then
        mya = myb
        Else
            Cells(newrow, newcolumn).Value = mytime
            Cells(newrow, newcolumn + 1).Value = Cells(rownow, columnnow - 1).Value
            Cells(newrow, newcolumn + 4).Value = Cells(rownow, columnnow).Value
            newrow = newrow + 1
        End If
        rownow = rownow + 1
        mytime = mytime + 1
    Wend
End Sub
 

Excel Facts

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

Code:
    Dim rng As Range
    On Error Resume Next
    Set rng = Application.InputBox("Select the first velocity data point that you would like to filter", Type:=8)
    On Error GoTo 0
    If rng Is Nothing Then Exit Sub
 
Upvote 0

Forum statistics

Threads
1,217,364
Messages
6,136,113
Members
449,993
Latest member
Sphere2215

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