Last Display on userform to a Listbox

abbas50

Board Regular
Joined
Dec 6, 2019
Messages
51
Office Version
  1. 2016
Platform
  1. Windows
VBA Code:
lstdisplay.ColumnCount = 15
lstdisplay.RowSource = "A1:O600000"

So when i do this it Displays everything on the sheet i am at i want to adjust that and when i use the userform it shows last 10 or 15 entries only and on the active sheet from userform any help?
 
I'm sorry but I just do not understand this. You said:
what i want is your coee of last 12 shown on a list box i can delete my last entry if i got a mistake thats all
If I got a mistake? Got a mistake doing what?
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
i have an entry form for data from my userform when i open it i type details to go to certain sheet this certain sheet goes to last row i want to see them if i got a mistake typing anything i dont wanna close my userform and go to the specific row and delete it manually i want to be able to delete it from the list box when its displayed
I'm sorry but I just do not understand this. You said:
what i want is your coee of last 12 shown on a list box i can delete my last entry if i got a mistake thats all
If I got a mistake? Got a mistake doing what?
 
Upvote 0
How about
VBA Code:
Private Sub CommandButton3_Click()
    Dim i As Long
    With Me.lstdisplay
        For i = 0 To .ListCount - 1
            If .Selected(i) Then
                Range("A" & Rows.Count).End(xlUp).Offset(-.ListCount + i + 1).EntireRow.Delete
            End If
        Next i
    End With
End Sub
 
Upvote 0
i have an entry form for data from my userform when i open it i type details to go to certain sheet this certain sheet goes to last row i want to see them if i got a mistake typing anything i dont wanna close my userform and go to the specific row and delete it manually i want to be able to delete it from the list box when its displayed

Hi @abbas50,
Sorry, I still don't understand what you need.
And I think we're just trying to guess.
Describe step by step what you need.
What data do you have and what do you expect from the result?
Do not worry about the code or how complicated it may seem, you explain and we will gladly help you.

Please Note
-----------------------
One thing you must keep in mind when you ask a question in a forum... the people you are asking to help you know absolutely nothing about your data, absolutely nothing about how it is laid out in the workbook, absolutely nothing about what you want done with it and absolutely nothing about how whatever it is you want done is to be presented back to you as a result... you must be very specific about describing each of these areas, in detail, and you should not assume that we will be able to "figure it out" on our own. Remember, you are asking us for help... so help us to be able to help you by providing the information we need to do so, even if that information seems "obvious" to you (remember, it is only obvious to you because of your familiarity with your data, its layout and the overall objective for it).
 
Upvote 0
Thank you once again for trying to help me out :)

my userform is a data entry form with multiple sheets i have accomplished to do that and when i enter my data it goes to the sheet i want with every option i need
saying that i just need for my last entries to show in a listbox i called lstdisplay to show my entries so if i entered any wrong information i can go to that row in the list box and select it and delete it without going sheet by sheet to delete it i dont want to keep closing my userform and going back and open it thats all :P thanks once again for trying to help me and im sorry for all the trouble im causing

Hi @abbas50,
Sorry, I still don't understand what you need.
And I think we're just trying to guess.
Describe step by step what you need.
What data do you have and what do you expect from the result?
Do not worry about the code or how complicated it may seem, you explain and we will gladly help you.

Please Note
-----------------------
One thing you must keep in mind when you ask a question in a forum... the people you are asking to help you know absolutely nothing about your data, absolutely nothing about how it is laid out in the workbook, absolutely nothing about what you want done with it and absolutely nothing about how whatever it is you want done is to be presented back to you as a result... you must be very specific about describing each of these areas, in detail, and you should not assume that we will be able to "figure it out" on our own. Remember, you are asking us for help... so help us to be able to help you by providing the information we need to do so, even if that information seems "obvious" to you (remember, it is only obvious to you because of your familiarity with your data, its layout and the overall objective for it).
 
Upvote 0
Have you tried my code in post#13?
sorry i didnt see it before i just tried it it works as i want but there is some issues when the line is deleted in my listbox it still shows it should update that it is deleted and if im on another sheet it gives a debug on lstdisplay on other code
VBA Code:
Dim HowManyRows As Long
HowManyRows = 12
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
lstdisplay.ColumnCount = 15
lstdisplay.Clear
lstdisplay.List = Cells(Lastrow - HowManyRows + 1, 1).Resize(HowManyRows, 15).Value
i want the code to show entries on multiple sheets :/
 
Upvote 0
I'm still watching this thread. Here you said:
i want the code to show entries on multiple sheets :/

See you must be specific. What multiple sheets?

Do you mean sheet named Alpha and sheet named Charlie and sheet named Foxtrot

Or sheets(1) to sheets(20)
 
Upvote 0
I'm still watching this thread. Here you said:
i want the code to show entries on multiple sheets :/

See you must be specific. What multiple sheets?

Do you mean sheet named Alpha and sheet named Charlie and sheet named Foxtrot

Or sheets(1) to sheets(20)
sheet names UAE, KSA, Bahrain
 
Upvote 0
And so by looking at the listbox how will we know what sheet this data in the listbox came from?
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,582
Members
449,039
Latest member
Arbind kumar

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