Code to Create an Active and Adapting List

asgreek

New Member
Joined
Apr 24, 2019
Messages
4
Hello,

I have written a code in vba that asks for an input between -9 and 9. When a user inputs a number and pushes a macro enabled button, data that is greater than or equal to the inputted number is displayed. My problem is the output is taking up too much of my worksheet and I would like to create a list like feature. There is a total of 6 columns and depending on the inputted number an output of 5 to 45 rows. Is an active X list my only option?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Any time you have some code and want it modified it's always best to post the code here in the Forum

Give us a example of the Output.

Maybe the output could be put in a Listbox or a Message Box on in a Textbox Shape.

A Message Box is in a lot of cases not the best as it is only displayed while the script is running.
 
Upvote 0
Any time you have some code and want it modified it's always best to post the code here in the Forum

Give us a example of the Output.

Maybe the output could be put in a Listbox or a Message Box on in a Textbox Shape.

A Message Box is in a lot of cases not the best as it is only displayed while the script is running.

Sorry, my code is below:
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]
Sub xx()
On Error Resume Next
er = Sheets("D2").Range("AA65536").End(xlUp).Row
ec = Range("IV1").End(xlToLeft).Column
r = 3
Range("A3:IV65536").ClearContents
If Cells(2, 1).Value > 0 Then
For i = 504 To er
a = Sheets("D2").Cells(i, "AA")
If WorksheetFunction.IsErr(a) Then a = 0

If a >= Cells(2, 1).Value Then
For j = 2 To ec
f = Cells(1, j)
Cells(r, j) = Sheets("D2").Cells(i, f)
Next j
r = r + 1
End If
Next i
Else
For i = 504 To er
a = Sheets("D2").Cells(i, "AA")
If WorksheetFunction.IsErr(a) Then a = 0
If a <= Cells(2, 1).Value Then
For j = 2 To ec
f = Cells(1, j)
Cells(r, j) = Sheets("D2").Cells(i, f)
Next j
r = r + 1
End If
Next i
End If
End Sub[/FONT]
 
Upvote 0
You said:
I have written a code in vba that asks for an input between -9 and 9. When a user inputs a number and pushes a macro enabled button, data that is greater than or equal to the inputted number is displayed.

I see nothing in your code that ask for a input.


Please explain in words what your attempting to do.

And this seems odd:

Sheets("D2").Cells(i, "AA")

You actually named your sheet "D2" ??

That looks more like a range

 
Upvote 0

Forum statistics

Threads
1,214,626
Messages
6,120,602
Members
448,974
Latest member
ChristineC

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