+ Reply to Thread
Results 1 to 3 of 3

convert this table into a list

Hybrid View

  1. #1
    Registered User
    Join Date
    05-28-2014
    Posts
    3

    convert this table into a list

    Hi, if anyone can help me I am trying to convert this table into a list, please see the examble
    examble.xlsx

    Thank you very much for helping me.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: convert this table into a list

    With this 2 macor's.

    See the attched file.

    I made headers in the sheet, for a working macro.

    I also renamed your sheetname in sheet1
    Sub CONVERTROWSTOCOL_Oeldere_revisted()
    
    Dim rsht1 As Long, rsht2 As Long, i As Long, col As Long, wsTest As Worksheet
    
    'check if sheet "ouput" already exist
    
    Const strSheetName As String = "Output"
     
    Set wsTest = Nothing
    On Error Resume Next
    Set wsTest = ActiveWorkbook.Worksheets(strSheetName)
    On Error GoTo 0
     
    If wsTest Is Nothing Then
        Worksheets.Add.Name = strSheetName
    End If
    
       
       With Sheets("Output")
        .UsedRange.ClearContents
        .Range("A1:D1").Value = Array("Number", "Project", "Value", "Column")
    
        End With
        
        
        rsht1 = Sheets("sheet1").Range("A" & Rows.Count).End(xlUp).Row
        rsht2 = Sheets("Output").Range("A" & Rows.Count).End(xlUp).Row
        col = 3
        
        For i = 2 To rsht1
                Do While Sheets("sheet1").Cells(1, col).Value <> ""
                rsht2 = rsht2 + 1
               
                Sheets("Output").Range("A" & rsht2).Value = Sheets("sheet1").Range("A" & i).Value
                
                Sheets("Output").Range("B" & rsht2).Value = Sheets("sheet1").Range("B" & i).Value
               
                Sheets("Output").Range("D" & rsht2).Value = Sheets("sheet1").Cells(1, col).Value
                
                Sheets("Output").Range("C" & rsht2).Value = Sheets("sheet1").Cells(i, col).Value
                
                
         
                col = col + 1
            Loop
            col = 3
        Next
      With Sheets("Output")
    
       Columns("A:Z").EntireColumn.AutoFit
        End With
    End Sub
    
    Sub Delete_empty_rows_Column_C()
    
    With Columns("C").SpecialCells(xlCellTypeBlanks).Cells
        .EntireRow.Delete Shift:=xlUp
      End With
      If Err.Number <> 0 Then MsgBox "There are no empty cells"
     End Sub
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Contributor pareshj's Avatar
    Join Date
    05-20-2014
    Location
    MUMBAI
    MS-Off Ver
    2007 & 2010
    Posts
    447

    Re: convert this table into a list

    Hi,

    Check the attached macro, see if it helps :examble.xlsm
    Click on "* Add Reputation" as a way to say thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Convert Table to List
    By Joanne Lim in forum Excel General
    Replies: 4
    Last Post: 05-12-2014, 02:36 AM
  2. Convert a table into a list - VBA
    By mkunkle1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-21-2013, 10:34 AM
  3. Convert Table to List
    By dereklast in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-04-2012, 01:27 PM
  4. Convert table into list
    By Eager2Learn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-27-2012, 09:34 AM
  5. Convert from table to a list
    By alexwangsa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-18-2008, 08:11 PM

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