Results 1 to 4 of 4

Display data on sheet (with formatting) to Userform

Threaded View

  1. #1
    Registered User
    Join Date
    10-07-2011
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    54

    Display data on sheet (with formatting) to Userform

    I would like to show the data on sheet to Userform (code shown below). My problem is on the sheet, I analyze data with some codes such as matching/ conditional formatting, etc., but it cant display on the userform. I would like to ask if anybody know how to make it or if it's possible.

    Thanks,

    PS. the data shown on the Userform, the width of each column is quite big (not the size of textbox). I would like to adjust it if's possible. please help!

    Private Sub UserForm_Initialize() 
         
        Dim rngData As Range 
        Dim lngRow As Long 
        Dim lngCol As Long 
         
        Set rngData = Range("R1:V17") 
        With ListBox1 
            .ColumnCount = rngData.Columns.Count 
             
            For lngRow = 1 To rngData.Rows.Count 
                For lngCol = 1 To rngData.Columns.Count 
                    If lngCol = 1 Then 
                        .AddItem rngData.Cells(lngRow, lngCol).Text 
                    Else 
                        .List(lngRow - 1, lngCol - 1) = rngData.Cells(lngRow, lngCol).Text 
                    End If 
                Next 
            Next 
             
             
        End With 
         
    End Sub
    Last edited by copythat; 10-26-2011 at 04:43 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1