Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 14th, 2005, 09:02 AM
Authorized User
 
Join Date: Dec 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Copying Multiple Rows

Hi All,

Can anyone tell me, how to retrieve multiple rows from excel. I am trying to retrieve, multiple selected rows and display it in a listbox in VBA.

If two rows are selected "Activecell" normally retreive the first cell from the selected area. But, what i want is the whole rows (multiple rows) and display it in the listbox.

Thanks
Johnson

 
Old April 19th, 2005, 05:10 AM
Authorized User
 
Join Date: Jan 2005
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try using Flexgrid instead of listbox



 
Old April 20th, 2005, 10:50 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 180
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I generally use the following code for populating a list or combo box...

Sub MakeDynamicListBox()
    Dim myVsRow As Integer
    Dim myloop As Integer
    Dim myListItem As String
    Dim myIndex As Integer

    Range("A1").select
'set number of rows in list
    myVsRow = Range("A65000").End(xlUp).Row

'apply the list items to the combo-box
    For myloop = 1 To myVsRow
        myListItem = CStr(ActiveCell.Offset(myloop, 0).Value)
        ListBox1.AddItem myListItem
    Next
End Sub

hope this has been helpful

Mat


 
Old May 6th, 2005, 03:58 AM
Authorized User
 
Join Date: Dec 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot for those information, but i found another way.

Regards
Johnson






Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying Rows to New worksheet eusanpe Excel VBA 7 December 21st, 2006 10:23 AM
Copying Multiple Rows in MS Excel 2K using VB .Net Azhar Akbari Excel VBA 2 January 27th, 2005 10:04 AM
print multiple times..multiple rows... abhit_kumar JSP Basics 3 January 18th, 2005 07:11 PM
Updating multiple Rows from multiple fields in ASP vdm_nana SQL Server ASP 0 April 1st, 2004 04:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.