Code to Create an Active and Adapting List

asgreek

New Member
Joined
Apr 24, 2019
Messages
2
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?
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,297
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.
 

sopa12

New Member
Joined
Mar 30, 2019
Messages
2
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]
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,297
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

 

Forum statistics

Threads
1,082,371
Messages
5,365,055
Members
400,819
Latest member
Gossow

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top