Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
<< 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 - |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to show Last Record in ListBox when loaded. | Excel Programming | |||
Hide Every Thing during UserForm Loads | Excel Programming | |||
Hide All Excel Toolbars, Menubars etc when UserForm Loads | Excel Programming | |||
UserForm Loads Slowly | Excel Programming | |||
Using a listbox to show every unique record in a range | Excel Worksheet Functions |