Import html notepad file to excel cells

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi

I opened the HTML file directly with Excel 2016, now it would be just a matter of adjusting the data layout to produce the desired table.
Would you like VBA code to do that?
 
Upvote 0
Helo worf....Yeah!!! Need VBA code to produce table of data from html data file...as specified pattern
Thank you for response...
Best wishes!!!
 
Upvote 0
Please test it:


Code:
Sub FillTable()
Dim c As Range, fa$, y(), i%, j%, ra(), r As Range, samp As Worksheet, fin As Worksheet, lr%, v
Set samp = Worksheets("sample")     ' HTML imported data
samp.[c:e].UnMerge
Set fin = Sheets("final")           ' table sheet
ReDim Preserve y(1 To 1)
With samp.Range("a1:a" & samp.Range("a" & Rows.Count).End(xlUp).Row)
    Set c = .Find("Design Code", LookIn:=xlValues)
    If Not c Is Nothing Then
        fa = c.Address
        i = 1
        Do
            ReDim Preserve y(1 To i)
            y(i) = c.Row
            i = i + 1
            Set c = .FindNext(c)
        Loop While Not c Is Nothing And c.Address <> fa
    End If
End With
ReDim Preserve y(1 To i)
y(i) = samp.Range("a" & Rows.Count).End(xlUp).Row
BubbleSort y
ReDim ra(1 To UBound(y))
For j = 1 To UBound(ra) - 1
    ra(j) = "a" & y(j) & ":a" & (y(j + 1) - 1)
Next
For i = LBound(ra) To UBound(ra) - 1
    lr = fin.Range("b" & Rows.Count).End(xlUp).Row
    Set c = fin.[b3]
    For j = 1 To 6
        Set r = samp.Range(ra(i)).Find(c, , xlValues, xlPart)
        fin.Cells(lr + 1, 1 + j) = Replace(r.Offset(, 2), ".", ",") ' if your separator is "," and not "."
        Set c = c.Offset(, 1)
    Next
    Set r = samp.Range(ra(i)).Find("Footing Size", , xlValues, xlPart)
    v = Split(r.Offset(, 2), "X")
    fin.Cells(lr + 1, 9) = Val(v(2))
    v = Split(r.Offset(, 2), "=")
    If UBound(v) > 0 Then fin.Cells(lr + 1, 10) = Val(v(1))
    Set r = samp.Range(ra(i)).Find("Reinforcement Along L", , xlValues, xlPart)
    Set r = samp.Range(r, samp.Cells(samp.Range("a" & Rows.Count).End(xlUp).Row, 1))
    Set c = r.Find("Ast Prv", r.Cells(1, 1), xlValues, xlPart, xlByRows, xlNext)
    fin.Cells(lr + 1, 11) = c.Offset(, 2)
    fin.Cells(lr + 1, 12) = c.Offset(1, 2)
    Set r = samp.Range(ra(i)).Find("Reinforcement Along B", , xlValues, xlPart)
    Set r = samp.Range(r, samp.Cells(samp.Range("a" & Rows.Count).End(xlUp).Row, 1))
    Set c = r.Find("Ast Prv", r.Cells(1, 1), xlValues, xlPart, xlByRows, xlNext)
    fin.Cells(lr + 1, 13) = c.Offset(, 2)
    fin.Cells(lr + 1, 14) = c.Offset(1, 2)
Next
End Sub


Sub BubbleSort(List())
Rem Sorts the List array in ascending order
Dim First As Long, Last As Long, i As Long, j&, Temp$
First = LBound(List)
Last = UBound(List)
For i = First To Last - 1
    For j = i + 1 To Last
        If List(i) > List(j) Then
            Temp = List(j)
            List(j) = List(i)
            List(i) = Temp
        End If
    Next
Next
End Sub
 
Upvote 0
Please test it:

Thank you for helping. i have tested but data not developed. can you guide me for instructions, for how to use your code..
if any possibility please attach excel file with code.


Best wishes...
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top