ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Show Last Record in the Listbox when userform Loads. (https://www.excelbanter.com/excel-programming/413631-show-last-record-listbox-when-userform-loads.html)

Shazi

Show Last Record in the Listbox when userform Loads.
 
Hi,

when I load my userform, the following procedure is showing the
listbox first record. how I can view the last record in the ListBox
when userform loads.

I am using this code:

Option Explicit
Dim LastRow As Long

Private Sub UserForm_Initialize()

Sheets("DailyIssue").Select

'to hide Blank Rows in ListBox.
LastRow = Worksheets("DailyIssue").Cells(Rows.Count,
"A").End(xlUp).Row
ListBox1.RowSource = "A5:J" & LastRow

End Sub


Regards.

Syed Shahzad Zafar

Bob Phillips

Show Last Record in the Listbox when userform Loads.
 
See previous posting

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Shazi" wrote in message
...
Hi,

when I load my userform, the following procedure is showing the
listbox first record. how I can view the last record in the ListBox
when userform loads.

I am using this code:

Option Explicit
Dim LastRow As Long

Private Sub UserForm_Initialize()

Sheets("DailyIssue").Select

'to hide Blank Rows in ListBox.
LastRow = Worksheets("DailyIssue").Cells(Rows.Count,
"A").End(xlUp).Row
ListBox1.RowSource = "A5:J" & LastRow

End Sub


Regards.

Syed Shahzad Zafar




Rick Rothstein \(MVP - VB\)[_2239_]

Show Last Record in the Listbox when userform Loads.
 
I think you want to do this at the end of your code...

ListBox1.ListIndex = ListBox1.ListCount - 1

Rick


"Shazi" wrote in message
...
Hi,

when I load my userform, the following procedure is showing the
listbox first record. how I can view the last record in the ListBox
when userform loads.

I am using this code:

Option Explicit
Dim LastRow As Long

Private Sub UserForm_Initialize()

Sheets("DailyIssue").Select

'to hide Blank Rows in ListBox.
LastRow = Worksheets("DailyIssue").Cells(Rows.Count,
"A").End(xlUp).Row
ListBox1.RowSource = "A5:J" & LastRow

End Sub


Regards.

Syed Shahzad Zafar



Rick Rothstein \(MVP - VB\)[_2241_]

Show Last Record in the Listbox when userform Loads.
 
Why did you post your question twice... and within 4 minutes of each other
no less? Did you really think that after 4 minutes you had waited too long
for a response? I only ask because there was no need for me to post my
answer as you already had the same answer from someone else in your other
question; however, I hadn't read to the other posting to see that before
constructing an answer to the first post I saw when I came online. The
people answering questions here are volunteers... there is not always
someone available... in the future, please just post your question once and
then wait... this way you won't waste the volunteers' time constructing
answers to questions you already have an answer to elsewhere.

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
I think you want to do this at the end of your code...

ListBox1.ListIndex = ListBox1.ListCount - 1

Rick


"Shazi" wrote in message
...
Hi,

when I load my userform, the following procedure is showing the
listbox first record. how I can view the last record in the ListBox
when userform loads.

I am using this code:

Option Explicit
Dim LastRow As Long

Private Sub UserForm_Initialize()

Sheets("DailyIssue").Select

'to hide Blank Rows in ListBox.
LastRow = Worksheets("DailyIssue").Cells(Rows.Count,
"A").End(xlUp).Row
ListBox1.RowSource = "A5:J" & LastRow

End Sub


Regards.

Syed Shahzad Zafar




Shazi

Show Last Record in the Listbox when userform Loads.
 
On Jul 7, 11:01*am, "Rick Rothstein \(MVP - VB\)"
wrote:
Why did you post your question twice... and within 4 minutes of each other
no less? Did you really think that after 4 minutes you had waited too long
for a response? I only ask because there was no need for me to post my
answer as you already had the same answer from someone else in your other
question; however, I hadn't read to the other posting to see that before
constructing an answer to the first post I saw when I came online. The
people answering questions here are volunteers... there is not always
someone available... in the future, please just post your question once and
then wait... this way you won't waste the volunteers' time constructing
answers to questions you already have an answer to elsewhere.

Rick

"Rick Rothstein (MVP - VB)" wrote in
. ..



I think you want to do this at the end of your code...


ListBox1.ListIndex = ListBox1.ListCount - 1


Rick


"Shazi" wrote in message
...
Hi,


when I load my userform, the following procedure is showing the
listbox *first record. how I can view the last record in the ListBox
when userform loads.


I am using this code:


Option Explicit
Dim LastRow As Long


Private Sub UserForm_Initialize()


Sheets("DailyIssue").Select


'to hide Blank Rows in ListBox.
LastRow = Worksheets("DailyIssue").Cells(Rows.Count,
"A").End(xlUp).Row
ListBox1.RowSource = "A5:J" & LastRow


End Sub


Regards.


Syed Shahzad Zafar- Hide quoted text -


- Show quoted text -


Dear Mr. Rick,

There was a problem with my Internet connection, it was stuck when I
tried to send my post, whenn I click on Send button, the blank screen
came out, and my pc was stuck, I closed the my browser from the Task
Manager.

It was not intentially, it was happen may be Internet connection
stopped or there was problem with my pc.

I am not sending any message twice, always I am waiting for my reply
at least 12 hours......... a day.

any way sorry for inconvenience.

Regards

Shahzad

Shazi

Show Last Record in the Listbox when userform Loads.
 
On Jul 7, 10:50*am, "Rick Rothstein \(MVP - VB\)"
wrote:
I think you want to do this at the end of your code...

ListBox1.ListIndex = ListBox1.ListCount - 1

Rick

"Shazi" wrote in message

...



Hi,


when I load my userform, the following procedure is showing the
listbox *first record. how I can view the last record in the ListBox
when userform loads.


I am using this code:


Option Explicit
Dim LastRow As Long


Private Sub UserForm_Initialize()


Sheets("DailyIssue").Select


'to hide Blank Rows in ListBox.
LastRow = Worksheets("DailyIssue").Cells(Rows.Count,
"A").End(xlUp).Row
ListBox1.RowSource = "A5:J" & LastRow


End Sub


Regards.


Syed Shahzad Zafar- Hide quoted text -


- Show quoted text -


Mr. Rick,
Hi,

If I want to see the first record in the Listbox then what to do.
pls help me.

Shahzad

Rick Rothstein \(MVP - VB\)[_2324_]

Show Last Record in the Listbox when userform Loads.
 
<< Top-Posted Listing Repaired

Please use the same posting order as your responder; in the case of this
thread, I top-posted my reply, so you should have top-posted your reply to
me (this makes it easier for anyone looking at this thread in the archives
to follow the replies in order of their posting).

To answer your question, the ListIndex is a zero-based index into the list
(much like the index value of an array). Since you want the first item in
the ListBox, and since the ListIndex is a zero-based index, you would use
this....

ListBox1.ListIndex = 0

to select the first item in the list.

Rick



If I want to see the first record in the Listbox then what to do.
pls help me.

"Shazi" wrote in message
...
On Jul 7, 10:50 am, "Rick Rothstein \(MVP - VB\)"
wrote:
I think you want to do this at the end of your code...

ListBox1.ListIndex = ListBox1.ListCount - 1

Rick

"Shazi" wrote in message

...



Hi,


when I load my userform, the following procedure is showing the
listbox first record. how I can view the last record in the ListBox
when userform loads.


I am using this code:


Option Explicit
Dim LastRow As Long


Private Sub UserForm_Initialize()


Sheets("DailyIssue").Select


'to hide Blank Rows in ListBox.
LastRow = Worksheets("DailyIssue").Cells(Rows.Count,
"A").End(xlUp).Row
ListBox1.RowSource = "A5:J" & LastRow


End Sub


Regards.


Syed Shahzad Zafar- Hide quoted text -


- Show quoted text -



Shazi

Show Last Record in the Listbox when userform Loads.
 
On Jul 16, 7:13*pm, "Rick Rothstein \(MVP - VB\)"
wrote:
<< Top-Posted Listing Repaired

Please use the same posting order as your responder; in the case of this
thread, I top-posted my reply, so you should have top-posted your reply to
me (this makes it easier for anyone looking at this thread in the archives
to follow the replies in order of their posting).

To answer your question, the ListIndex is a zero-based index into the list
(much like the index value of an array). Since you want the first item in
the ListBox, and since the ListIndex is a zero-based index, you would use
this....

ListBox1.ListIndex = 0

to select the first item in the list.

Rick

If I want to see the first record in the Listbox then what to do.
pls help me.


"Shazi" wrote in message

...
On Jul 7, 10:50 am, "Rick Rothstein \(MVP - VB\)"



wrote:
I think you want to do this at the end of your code...


ListBox1.ListIndex = ListBox1.ListCount - 1


Rick


"Shazi" wrote in message


...


Hi,


when I load my userform, the following procedure is showing the
listbox first record. how I can view the last record in the ListBox
when userform loads.


I am using this code:


Option Explicit
Dim LastRow As Long


Private Sub UserForm_Initialize()


Sheets("DailyIssue").Select


'to hide Blank Rows in ListBox.
LastRow = Worksheets("DailyIssue").Cells(Rows.Count,
"A").End(xlUp).Row
ListBox1.RowSource = "A5:J" & LastRow


End Sub


Regards.


Syed Shahzad Zafar- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


Hi,

Thank you Mr. Rick, now its working properly.

Regards.

Shahzad

Rick Rothstein \(MVP - VB\)[_2334_]

Show Last Record in the Listbox when userform Loads.
 
You are welcome, but you bottom-posted your answer again.

Rick


"Shazi" wrote in message
...
On Jul 16, 7:13 pm, "Rick Rothstein \(MVP - VB\)"
wrote:
<< Top-Posted Listing Repaired

Please use the same posting order as your responder; in the case of this
thread, I top-posted my reply, so you should have top-posted your reply to
me (this makes it easier for anyone looking at this thread in the archives
to follow the replies in order of their posting).

To answer your question, the ListIndex is a zero-based index into the list
(much like the index value of an array). Since you want the first item in
the ListBox, and since the ListIndex is a zero-based index, you would use
this....

ListBox1.ListIndex = 0

to select the first item in the list.

Rick

If I want to see the first record in the Listbox then what to do.
pls help me.


"Shazi" wrote in message

...
On Jul 7, 10:50 am, "Rick Rothstein \(MVP - VB\)"



wrote:
I think you want to do this at the end of your code...


ListBox1.ListIndex = ListBox1.ListCount - 1


Rick


"Shazi" wrote in message


...


Hi,


when I load my userform, the following procedure is showing the
listbox first record. how I can view the last record in the ListBox
when userform loads.


I am using this code:


Option Explicit
Dim LastRow As Long


Private Sub UserForm_Initialize()


Sheets("DailyIssue").Select


'to hide Blank Rows in ListBox.
LastRow = Worksheets("DailyIssue").Cells(Rows.Count,
"A").End(xlUp).Row
ListBox1.RowSource = "A5:J" & LastRow


End Sub


Regards.


Syed Shahzad Zafar- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


Hi,

Thank you Mr. Rick, now its working properly.

Regards.

Shahzad



All times are GMT +1. The time now is 07:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com