Results 1 to 2 of 2

Transpose web data from horizontal (rows) to vertical (columns) for html files

Threaded View

Dahlia Transpose web data from... 08-22-2018, 11:59 PM
Dahlia Re: Transpose web data from... 08-23-2018, 11:02 AM
  1. #1
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Transpose web data from horizontal (rows) to vertical (columns) for html files

    Hi Excel Experts,

    Recently, I posted similar subject and I got the perfect answer from Marc L via below link:-

    Transpose Data

    I had clicked as Solved as it has perfectly done for my web data for Work Orders. However, I couldn't get it to do the same for my Incidents. I didn't give the samples from Incidents earlier because I saw from browser view they're displayed just the same, just that Incidents is saved under extension .html (which I understood no diff with .htm files) and have only 5 fields instead of 6(exclude the Communication Source)(which I thought I could just do minor modification in the given macro to suit that).
    But, I have tried couple of days now, I still didn't get it to paste from web data Incidents. The macro will run without errors, but no output for Incidents, only Work Orders.
    Below is the given macro and attached are the samples of Web Data for both Work Order and Incident accordingly for your kind perusal.

    Aside to the above, if it's not so much trouble, I would like to ask if the macro can give output to the next sheet instead of strictly in Sheet1 only because I would like to park the macro action buttons in Sheet1, but the populated output should be in the new worksheet. I'm totally not used to the "usedrange" command, so whichever my trials and erros on changing the given codes were not succeeded.

    Sub Demo1() 
              Dim L&, P$, F$, Rg As Range, R& 
              Me.UsedRange.Offset(1).Clear 
              Application.ScreenUpdating = False 
              L = 1 
              P = ThisWorkbook.Path & "\Sample Source Data\" 
              F = Dir(P & "*.htm") 
        While F > "" 
            With Workbooks.Open(P & F).Worksheets(1).UsedRange.Columns(1) 
                   Set Rg = .Find("Work Order ID", , xlValues, xlWhole) 
                If Not Rg Is Nothing Then 
                        R = Rg.Row 
                    Do 
                        With Rg.CurrentRegion.Rows 
                           V = Application.Index(.Columns(2), [COLUMN(A:F)]) 
                           If .Count > 6 Then V(6) = Join(Application.Index(.Item("6:" & .Count).Columns(2), _ 
                                      Evaluate("COLUMN(" & [A1].Resize(, .Count - 5).Address & ")")), vbLf) 
                        End With 
                           L = L + 1 
                           Cells(L, 1).Resize(, 6).Value = V 
                           Set Rg = .FindNext(Rg) 
                    Loop While Rg.Row > R 
                End If 
                   .Parent.Parent.Close False 
            End With 
              F = Dir 
        Wend 
              Set Rg = Nothing 
              Application.ScreenUpdating = True 
    End Sub
    Appreciate your help.

    Thanks in advance.
    DZ
    Attached Files Attached Files
    Last edited by Dahlia; 08-23-2018 at 12:06 AM. Reason: Additional Requirements

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Transpose web data from horizontal (rows) to vertical (columns)
    By Dahlia in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-13-2018, 06:10 AM
  2. Transpose vertical data to horizontal
    By PeterKeown in forum Excel General
    Replies: 6
    Last Post: 08-03-2018, 05:51 AM
  3. Replies: 3
    Last Post: 04-27-2015, 05:26 PM
  4. Replies: 4
    Last Post: 08-22-2013, 11:56 AM
  5. [SOLVED] Converting Vertical Columns in to Horizontal Rows - (Better solution to Transpose)
    By ps_upasani in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-30-2013, 05:32 AM
  6. Transpose Vertical Data to Horizontal
    By Randu555 in forum Excel General
    Replies: 5
    Last Post: 04-18-2013, 05:05 PM
  7. Replies: 2
    Last Post: 06-06-2012, 07:13 PM

Tags for this Thread

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