<?xml version="1.0"?>
<rss version="2.0">
   <channel>
      <title>Excel Macro - VBA by Norhayati Isa</title>
      <link>https://padlet.com/nor97/z27kazz7jpy24fxc</link>
      <description></description>
      <language>en-us</language>
      <pubDate>2025-09-30 01:05:03 UTC</pubDate>
      <lastBuildDate>2025-10-24 08:00:37 UTC</lastBuildDate>
      <webMaster>hello@padlet.com</webMaster>
      <image>
         <url></url>
      </image>
      <item>
         <title></title>
         <author>nor97</author>
         <link>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3610292091</link>
         <description><![CDATA[<p>hello, welcome....</p>]]></description>
         <enclosure url="" />
         <pubDate>2025-09-30 01:18:41 UTC</pubDate>
         <guid>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3610292091</guid>
      </item>
      <item>
         <title></title>
         <author>nor97</author>
         <link>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3610304277</link>
         <description><![CDATA[]]></description>
         <enclosure url="https://padlet-uploads-usc1.storage.googleapis.com/4469395667/3b203fb7e9fb19436332c97f38f08d36/Lesson1a_SampleMacros.xlsm" />
         <pubDate>2025-09-30 01:24:29 UTC</pubDate>
         <guid>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3610304277</guid>
      </item>
      <item>
         <title>📌 Introduction</title>
         <author>nor97</author>
         <link>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3610584936</link>
         <description><![CDATA[<p>When running long VBA macros, users often think Excel has frozen because there’s no visible feedback. A progress bar improves the user experience by showing the macro’s status or stage. Unlike Application.StatusBar, which shows only text, a progress bar provides a clear visual indicator.</p><p><br></p><p>📌 What is a VBA Progress Bar?</p><p><br></p><p>A progress bar is a visual control (usually in a UserForm) that updates as your code executes. It doesn’t speed up the macro—it just informs users about progress.</p><p><br></p><p>📌 When to Use</p><p><br></p><p>Long-running loops (e.g., processing thousands of rows).</p><p><br></p><p>Multi-step workflows (e.g., Excel → Word → Outlook automation).</p><p><br></p><p>End-to-end processes where you want to reassure users.</p><p><br></p><p>📌 How It Works</p><p><br></p><p>UserForm with a Label or Frame → acts as the bar.</p><p><br></p><p>Macro updates width/percentage as tasks complete.</p><p><br></p><p>DoEvents ensures Excel updates the form while code runs.</p><p><br></p><p>Close the form once the macro finishes.</p><p><br></p><p>📌 Best Practices</p><p><br></p><p>Keep it lightweight – don’t add heavy graphics that slow VBA further.</p><p><br></p><p>Update occasionally – updating on every loop iteration can slow things down; update every 50/100 rows instead.</p><p><br></p><p>Give context – label the current step (e.g., “Exporting to Word…”).</p><p><br></p><p>Fail gracefully – ensure the bar closes even if an error occurs.</p><p><br></p><p>📌 Simple Example (Downloadable Sample Possible)</p><p><br></p><p>Insert a UserForm named frmProgress.</p><p><br></p><p>Add a Label named lblBar (the bar itself).</p><p><br></p><p>Add a Label named lblText (status message).</p><p><br></p><p>VBA Code:</p><p><br></p><p>'=== Standard Module ===</p><p>Sub RunWithProgressBar()</p><p>    Dim i As Long, n As Long</p><p>    n = 1000</p><p>    </p><p>    ' Show progress bar</p><p>    frmProgress.Show vbModeless</p><p>    frmProgress.lblBar.Width = 0</p><p>    </p><p>    For i = 1 To n</p><p>        ' Simulate work</p><p>        DoEvents</p><p>        Application.Wait Now + TimeValue("0:00:01")</p><p>        </p><p>        ' Update progress bar every 50 iterations</p><p>        If i Mod 50 = 0 Then</p><p>            UpdateProgress i, n, "Processing row " &amp; i</p><p>        End If</p><p>    Next i</p><p>    </p><p>    ' Done</p><p>    Unload frmProgress</p><p>    MsgBox "All tasks completed!", vbInformation</p><p>End Sub</p><p><br></p><p>'=== UserForm Module ===</p><p>Sub UpdateProgress(ByVal i As Long, ByVal n As Long, Optional ByVal msg As String)</p><p>    With frmProgress</p><p>        .lblBar.Width = (.InsideWidth - 20) * (i / n)</p><p>        .lblText.Caption = Format(i / n, "0%") &amp; " - " &amp; msg</p><p>        .Repaint</p><p>    End With</p><p>End Sub</p>]]></description>
         <enclosure url="" />
         <pubDate>2025-09-30 04:05:54 UTC</pubDate>
         <guid>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3610584936</guid>
      </item>
      <item>
         <title>Add Progress Bar to VBA Macro</title>
         <author>nor97</author>
         <link>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3610786050</link>
         <description><![CDATA[<p>Put the code in the right place (Option A)</p><ol><li><p><strong>Open VBE</strong>: Alt+F11</p></li><li><p><strong>Project Explorer</strong>: press <strong>Ctrl+R</strong></p></li><li><p>Under your VBAProject, find the <strong>Forms</strong> section (you’ll see a form icon).</p><ul><li><p>Double-click <strong>frmProgress</strong> (if your form is still called <em>UserForm1</em>, rename its <strong>(Name)</strong> to frmProgress first).</p></li><li><p>The code window title must say <strong>“Code – frmProgress”</strong>.</p></li></ul></li><li><p>In that <strong>frmProgress</strong> code window, paste this (replace anything you had before):</p></li></ol><pre><code>Option Explicit

Private Sub UserForm_Initialize()
    lblBar.Width = 0
    lblText.Caption = "0% - Starting..."
End Sub

Public Sub UpdateProgress(ByVal i As Long, ByVal total As Long, Optional ByVal msg As String)
    Dim pct As Double

    If total &lt; 1 Then total = 1
    pct = i / total

    If pct &lt; 0 Then
        pct = 0
    ElseIf pct &gt; 1 Then
        pct = 1
    End If

    ' use Me ONLY inside the form's code-behind
    Me.lblBar.Width = (Me.InsideWidth - 20) * pct
    Me.lblText.Caption = Format(pct, "0%") &amp; IIf(Len(msg) &gt; 0, " - " &amp; msg, "")
    Me.Repaint
    DoEvents
End Sub
</code></pre><ol start="5"><li><p><strong>Very important:</strong> remove any copy of UpdateProgress you might have pasted into <strong>Module1/standard modules</strong>. There should be <strong>no</strong> Me in standard modules.</p></li><li><p><strong>Compile</strong>: menu <strong>Debug → Compile VBAProject</strong>. If it compiles, you’re good.</p></li></ol><p>Call it from your macro</p><p>At the start of your macro:</p><pre><code>frmProgress.Show vbModeless
frmProgress.UpdateProgress 0, 1, "Preparing..."
</code></pre><p>Update during your outer loop:</p><pre><code>frmProgress.UpdateProgress x, totalSteps, "Category: " &amp; CStr(vCategory(x))
</code></pre><p>Always close (success or error):</p><pre><code>Unload frmProgress</code></pre>]]></description>
         <enclosure url="" />
         <pubDate>2025-09-30 06:30:13 UTC</pubDate>
         <guid>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3610786050</guid>
      </item>
      <item>
         <title>VBA Filter</title>
         <author>nor97</author>
         <link>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3610791472</link>
         <description><![CDATA[<p>In VBA, the AutoFilter method can filter <strong>up to 256 columns</strong> in older versions of Excel (pre-2007), and <strong>up to 16,384 columns</strong> in modern versions (Excel 2007 and later) because the worksheet now supports columns from A to XFD.</p><p>However, <strong>practical best practice</strong> limits filtering to <strong>5–10 columns</strong> for performance and clarity. Here's why:</p><p>✅ What VBA <em>Can</em> Do</p><ul><li><p>Filter any number of columns using .AutoFilter Field:=n</p></li><li><p>Apply different criteria per column</p></li><li><p>Combine filters across columns using AND logic (default behavior)</p></li><li><p>Use &lt;&gt;, &gt;, &lt;, =*, wildcards, and date ranges</p></li></ul><p>🚫 What VBA <em>Cannot</em> Do Directly</p><ul><li><p>Apply <strong>OR logic across columns</strong> (e.g., show rows where Col1 = "X" OR Col2 = "Y")—requires helper columns or manual row hiding</p></li><li><p>Filter <strong>non-contiguous columns</strong> unless you define a custom range</p></li><li><p>Filter by <strong>color, icon, or formula result</strong> without extra logic</p></li></ul><p>🧠 Best Practice Summary</p><p>TipWhy It MattersLimit to 5–10 columnsKeeps macros fast and readableUse named ranges or tablesEasier to maintainUse helper columns for complex logicEnables OR filters or multi-condition checksAvoid filtering every columnSlows down UI and increases risk of errors</p>]]></description>
         <enclosure url="https://padlet-uploads-usc1.storage.googleapis.com/4469395667/2eb08453a6eb742d80d74f03ab2e7645/L3c_Filter_SalesTbl.xlsx" />
         <pubDate>2025-09-30 06:34:04 UTC</pubDate>
         <guid>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3610791472</guid>
      </item>
      <item>
         <title>Autofilter with VBA</title>
         <author>nor97</author>
         <link>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3610809327</link>
         <description><![CDATA[<p>filter by region</p><p><br/></p><pre><code>Sub Filter_ByRegion()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets("SalesTbl") ' Adjust if sheet name differs

    With ws
        .AutoFilterMode = False ' Clear previous filters
        .Range("A1").CurrentRegion.AutoFilter Field:=2, Criteria1:="North" ' Field 2 = Region column
    End With
End Sub</code></pre><p>region - single column multiple values</p><pre><code>Sub Filter_Region_MultipleValues()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets("Data") ' Adjust if sheet name differs

    With ws
        .AutoFilterMode = False
        .Range("A1").CurrentRegion.AutoFilter _
            Field:=3, _
            Criteria1:=Array("North", "South", "East"), _
            Operator:=xlFilterValues
    End With
End Sub</code></pre><p>multiple regions and multiple values</p><p><br/></p><pre><code>Sub Filter_RegionAndCountry()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets("data") ' Adjust if sheet name differs

    With ws
        .AutoFilterMode = False
        .Range("A1").CurrentRegion.AutoFilter _
            Field:=3, _
            Criteria1:=Array("North", "South", "East"), _
            Operator:=xlFilterValues

        .Range("A1").CurrentRegion.AutoFilter _
            Field:=4, _
            Criteria1:=Array("Brunei", "Malaysia", "Singapore", "Thailand", "Vietnam"), _
            Operator:=xlFilterValues
    End With
End Sub</code></pre><p>filter excluding selected values</p><pre><code>Sub Setup_ExcludeHelper()
    Dim ws As Worksheet
    Dim excludeList As Variant
    Dim lastRow As Long, i As Long

    Set ws = ThisWorkbook.Sheets("Data")
    excludeList = Split(ws.Parent.Sheets("inputform").Range("F5").Text, ",")
    lastRow = ws.Cells(ws.Rows.Count, 3).End(xlUp).Row

    ws.Range("u1").Value = "IncludeFlag"

    For i = 2 To lastRow
        If IsError(Application.Match(ws.Cells(i, 3).Value, excludeList, 0)) Then
            ws.Cells(i, 21).Value = "TRUE"
        Else
            ws.Cells(i, 21).Value = "FALSE"
        End If
    Next i
    
    ' Apply filter on helper column (assumed to be column 26 = Z)
    ws.Range("A1").CurrentRegion.AutoFilter _
        Field:=21, _
        Criteria1:="TRUE"
End Sub</code></pre>]]></description>
         <enclosure url="" />
         <pubDate>2025-09-30 06:45:04 UTC</pubDate>
         <guid>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3610809327</guid>
      </item>
      <item>
         <title>vba date cleansing</title>
         <author>nor97</author>
         <link>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3610938517</link>
         <description><![CDATA[<pre><code>Sub Clean_StandardizeDates_dd_mm_yyyy()
    Dim ws As Worksheet
    Dim lastRow As Long
    Dim i As Long
    Dim cell As Range
    Dim rawDate As Variant

    Set ws = ThisWorkbook.Sheets("SalesTbl") ' Adjust sheet name if needed
    lastRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row

    For i = 2 To lastRow
        Set cell = ws.Cells(i, 1)
        rawDate = Trim(CStr(cell.Value)) ' Remove leading/trailing spaces

        ' Remove apostrophe if present
        If Left(rawDate, 1) = "'" Then rawDate = Mid(rawDate, 2)

        ' Try to convert to date
        If IsDate(rawDate) Then
            cell.Value = Int(CDate(rawDate)) ' Strip time
            cell.NumberFormat = "dd-mm-yyyy"
        Else
            ' Try parsing manually if needed (e.g., yyyy.mm.dd or mm-dd-yyyy)
            On Error Resume Next
            cell.Value = Int(CDate(rawDate))
            cell.NumberFormat = "dd-mm-yyyy"
            On Error GoTo 0
        End If
    Next i

    MsgBox "All dates cleaned and standardized to dd-mm-yyyy!"
End Sub</code></pre><p>data cleansing by Gemini</p><p><br></p><p>Sub CleanAndFormatDateColumn()</p><p>    ' 1. Setup Variables</p><p>    Dim ws As Worksheet</p><p>    Dim lastRow As Long</p><p>    Dim cell As Range</p><p>    Dim dateValue As Variant</p><p>    ' Set the worksheet (Modify "Sheet1" to your actual sheet name)</p><p>    Set ws = ActiveSheet</p><p>    ' Determine the last row with data in Column A</p><p>    ' Assumes data starts in row 2</p><p>    lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row</p><p>    ' 2. Loop Through Column A (Starting from A2 to skip header)</p><p>    For Each cell In ws.Range("A2:A" &amp; lastRow)</p><p>        ' Reset error handling for this loop iteration</p><p>        On Error GoTo 0</p><p>        ' Try to convert the cell value to a date</p><p>        On Error Resume Next</p><p>        dateValue = CDate(cell.Value)</p><p>        On Error GoTo 0 ' Turn off error handling immediately after the CDate attempt</p><p>        ' 3. Process the Result</p><p>        If IsDate(dateValue) Then</p><p>            ' Conversion successful:</p><p>            ' a. Write the clean date back to the cell (removes any time component)</p><p>            cell.Value = Int(dateValue)</p><p>            ' b. Format the cell as a consistent date format</p><p>            cell.NumberFormat = "yyyy-mm-dd" ' A clear, universal format</p><p>        Else</p><p>            ' Conversion failed (e.g., "invalid text"):</p><p>            ' You can leave the original text or mark it.</p><p>            cell.Interior.Color = RGB(255, 255, 153) ' Highlight in yellow for manual review</p><p>            cell.NumberFormat = "@"                  ' Ensure it's treated as text</p><p>        End If</p><p>    Next cell</p><p>    ' Final message</p><p>    MsgBox "Date column cleaning complete! Cells that could not be converted are highlighted in yellow.", vbInformation</p><p>End Sub</p><p><br></p>]]></description>
         <enclosure url="" />
         <pubDate>2025-09-30 08:13:32 UTC</pubDate>
         <guid>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3610938517</guid>
      </item>
      <item>
         <title>web scraping</title>
         <author>nor97</author>
         <link>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3611007366</link>
         <description><![CDATA[<p>Sub Get_ExchangeRates()</p><p>    Dim url As String</p><p>    Dim xhr As Object, dom As Object</p><p>    Dim ws As Worksheet</p><p>    Dim dateNode As Object, rateNode As Object</p><p>    Dim r As Long</p><p>    url = "<a rel="noopener noreferrer nofollow" href="https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml">https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml</a>"</p><p>    Sheets.Add after:=Sheets(Sheets.Count)</p><p>    Set ws = ActiveSheet</p><p>    ws.Cells.Clear</p><p>    ' Download XML</p><p>    Set xhr = CreateObject("MSXML2.XMLHTTP")</p><p>    <a rel="noopener noreferrer nofollow" href="http://xhr.Open">xhr.Open</a> "GET", url, False</p><p>    xhr.send</p><p>    If xhr.Status &lt;&gt; 200 Then</p><p>        MsgBox "HTTP error: " &amp; xhr.Status &amp; " - " &amp; xhr.statusText, vbExclamation</p><p>        Exit Sub</p><p>    End If</p><p>    ' Load into XML DOM</p><p>    Set dom = CreateObject("MSXML2.DOMDocument.6.0")</p><p>    dom.async = False</p><p>    dom.validateOnParse = False</p><p>    If Not dom.LoadXML(xhr.responseText) Then</p><p>        MsgBox "XML parse error: " &amp; dom.parseError.Reason, vbExclamation</p><p>        Exit Sub</p><p>    End If</p><p>    ' --- IMPORTANT: namespaces ---</p><p>    ' default namespace for &lt;Cube&gt; is ECB eurofxref ns; we must bind a prefix (ecb)</p><p>    dom.setProperty "SelectionLanguage", "XPath"</p><p>    dom.setProperty "SelectionNamespaces", _</p><p>        "xmlns:ges='<a rel="noopener noreferrer nofollow" href="http://www.gesmes.org/xml/2002-08-01">http://www.gesmes.org/xml/2002-08-01</a>' " &amp; _</p><p>        "xmlns:ecb='<a rel="noopener noreferrer nofollow" href="http://www.ecb.int/vocabulary/2002-08-01/eurofxref">http://www.ecb.int/vocabulary/2002-08-01/eurofxref</a>'"</p><p>    ' Find the dated Cube and iterate its child rates</p><p>    Set dateNode = dom.selectSingleNode("//ecb:Cube/ecb:Cube[@time]")</p><p>    If dateNode Is Nothing Then</p><p>        ws.Range("A1").Value = "Could not find dated node. Dumping first 500 chars for debugging:"</p><p>        ws.Range("A2").Value = Left$(xhr.responseText, 500)</p><p>        MsgBox "Could not find the &lt;Cube time='...'&gt; node (namespace issue solved in code; if you still see this, check the dump on the sheet).", vbExclamation</p><p>        Exit Sub</p><p>    End If</p><p>    ws.Range("A1:C1").Value = Array("Date", "Currency", "Rate")</p><p>    r = 2</p><p>    For Each rateNode In dateNode.selectNodes("ecb:Cube[@currency]")</p><p>        ws.Cells(r, 1).Value = dateNode.getAttribute("time")</p><p>        ws.Cells(r, 2).Value = rateNode.getAttribute("currency")</p><p>        ws.Cells(r, 3).Value = CDbl(rateNode.getAttribute("rate"))</p><p>        r = r + 1</p><p>    Next rateNode</p><p>    ' Add EUR = 1.0 (base)</p><p>    ws.Cells(r, 1).Value = dateNode.getAttribute("time")</p><p>    ws.Cells(r, 2).Value = "EUR"</p><p>    ws.Cells(r, 3).Value = 1#</p><p>    ws.Columns("A:C").AutoFit</p><p>    ws.Rows(1).Font.Bold = True</p><p>    MsgBox "Exchange rates retrieved: " &amp; (r - 2) &amp; " currencies.", vbInformation</p><p>End Sub</p><p><br></p><p><br></p><p>retrieve from local folder</p><p>Option Explicit</p><p>Public Sub Scrape_ProductsHtml()</p><p>    Dim f As Variant, htmlText As String</p><p>    Dim doc As Object ' HTMLDocument (late bound)</p><p>    Dim ws As Worksheet, r As Long, c As Long</p><p>    Dim tbls As Object, t As Object, row As Object, cell As Object</p><p>    Dim items As Object, it As Object</p><p>    '---- pick the local HTML file (defaults to products.html) ----</p><p>    f = Application.GetOpenFilename("HTML Files (*.htm;*.html),*.htm;*.html", , _</p><p>                                    "Select products.html", , False)</p><p>    If VarType(f) = vbBoolean Then Exit Sub ' user cancelled</p><p>    htmlText = ReadAllText(CStr(f))</p><p>    If Len(htmlText) = 0 Then</p><p>        MsgBox "File is empty or unreadable.", vbExclamation</p><p>        Exit Sub</p><p>    End If</p><p>    '---- load into an HTML parser ----</p><p>    Set doc = CreateObject("htmlfile")</p><p>    <a rel="noopener noreferrer nofollow" href="http://doc.Open">doc.Open</a></p><p>    doc.Write htmlText</p><p>    doc.Close</p><p>    '---- new output sheet ----</p><p>    Sheets.Add after:=Sheets(Sheets.Count)</p><p>    Set ws = ActiveSheet</p><p>    ws.Cells.Clear</p><p>    r = 1</p><p>    '========== MODE A: dump all HTML tables ==========</p><p>    Set tbls = doc.getElementsByTagName("table")</p><p>    If Not tbls Is Nothing And tbls.Length &gt; 0 Then</p><p>        Dim tIdx As Long: tIdx = 1</p><p>        For Each t In tbls</p><p>            If r &gt; 1 Then r = r + 2</p><p>            ws.Cells(r, 1).Value = "Table " &amp; tIdx</p><p>            ws.Cells(r, 1).Font.Bold = True</p><p>            r = r + 1</p><p>            For Each row In t.getElementsByTagName("tr")</p><p>                c = 1</p><p>                For Each cell In row.Children    ' td/th</p><p>                    ws.Cells(r, c).Value = CleanText(cell.innerText)</p><p>                    c = c + 1</p><p>                Next cell</p><p>                r = r + 1</p><p>            Next row</p><p>            tIdx = tIdx + 1</p><p>        Next t</p><p>        ws.Columns.AutoFit</p><p>        MsgBox "Scraped " &amp; tbls.Length &amp; " table(s) from HTML.", vbInformation</p><p>        Exit Sub</p><p>    End If</p><p>    '========== MODE B: ".product" cards/list ==========</p><p>    ' Adjust the selectors to match your markup</p><p>    On Error Resume Next</p><p>    Set items = doc.querySelectorAll(".product")</p><p>    On Error GoTo 0</p><p>    If Not items Is Nothing And items.Length &gt; 0 Then</p><p>        ' headers</p><p>        ws.Range("A1:C1").Value = Array("Name", "Price", "SKU")</p><p>        r = 2</p><p>        For Each it In items</p><p>            ws.Cells(r, 1).Value = CleanText(QText(it, ".name"))</p><p>            ws.Cells(r, 2).Value = CleanText(QText(it, ".price"))</p><p>            ws.Cells(r, 3).Value = AttrOf(it, "data-sku")</p><p>            r = r + 1</p><p>        Next it</p><p>        ws.Columns("A:C").AutoFit</p><p>        ws.Rows(1).Font.Bold = True</p><p>        MsgBox "Scraped " &amp; items.Length &amp; " product card(s).", vbInformation</p><p>        Exit Sub</p><p>    End If</p><p>    ' If neither layout found, drop a hint</p><p>    ws.Range("A1").Value = "No &lt;table&gt; or .product items found."</p><p>    ws.Range("A2").Value = "Tip: change the CSS selectors in MODE B to match your HTML."</p><p>    MsgBox "Nothing matched. Check selectors or HTML structure.", vbExclamation</p><p>End Sub</p><p>'----------------- helpers -----------------</p><p>Private Function ReadAllText(ByVal path As String) As String</p><p>    Dim ff As Integer: ff = FreeFile</p><p>    On Error GoTo Fail</p><p>    Open path For Binary As #ff</p><p>    ReadAllText = Space$(LOF(ff))</p><p>    Get #ff, , ReadAllText</p><p>    Close #ff</p><p>    Exit Function</p><p>Fail:</p><p>    On Error Resume Next</p><p>    If ff &lt;&gt; 0 Then Close #ff</p><p>End Function</p><p>' Returns innerText of first match for CSS selector under node (or "")</p><p>Private Function QText(ByVal node As Object, ByVal css As String) As String</p><p>    Dim el As Object</p><p>    On Error Resume Next</p><p>    Set el = node.querySelector(css)</p><p>    On Error GoTo 0</p><p>    If Not el Is Nothing Then QText = el.innerText</p><p>End Function</p><p>' Returns attribute value (or "")</p><p>Private Function AttrOf(ByVal node As Object, ByVal name As String) As String</p><p>    On Error Resume Next</p><p>    AttrOf = node.getAttribute(name)</p><p>    On Error GoTo 0</p><p>End Function</p><p>' Trim and collapse whitespace/newlines</p><p>Private Function CleanText(ByVal s As String) As String</p><p>    Dim t As String</p><p>    t = Trim$(s)</p><p>    t = Replace(t, vbCr, " ")</p><p>    t = Replace(t, vbLf, " ")</p><p>    Do While InStr(t, "  ") &gt; 0</p><p>        t = Replace(t, "  ", " ")</p><p>    Loop</p><p>    CleanText = t</p><p>End Function</p>]]></description>
         <enclosure url="" />
         <pubDate>2025-09-30 09:01:36 UTC</pubDate>
         <guid>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3611007366</guid>
      </item>
      <item>
         <title>VBA-Euro Exchange Rate</title>
         <author>chinfangtey</author>
         <link>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3611040898</link>
         <description><![CDATA[<p>Sub GetECBExchangeRates_Edge()</p><p>    Dim http As Object</p><p>    Dim html As Object</p><p>    Dim tbl As Object</p><p>    Dim row As Object, cell As Object</p><p>    Dim i As Long, j As Long</p><p>    Dim wks As Worksheet</p><p>    Set wks = ThisWorkbook.Sheets("ExchangeRates")</p><p>    ' Create HTTP and HTML objects</p><p>    Set http = CreateObject("MSXML2.XMLHTTP")</p><p>    Set html = CreateObject("htmlfile")</p><p>    </p><p>    ' Fetch the ECB exchange rates page</p><p>    <a rel="noopener noreferrer nofollow" href="http://http.Open">http.Open</a> "GET", "<a rel="noopener noreferrer nofollow" href="https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html">https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html</a>", False</p><p>    http.send</p><p>    </p><p>    ' Load the HTML content</p><p>    html.body.innerHTML = http.responseText</p><p>    ' Find the exchange rate table</p><p>    Set tbl = html.getElementsByTagName("table")(0) ' First table on the page</p><p>    ' Output to Excel starting at cell A1</p><p>    i = 1</p><p>    For Each row In tbl.getElementsByTagName("tr")</p><p>        j = 1</p><p>        For Each cell In row.getElementsByTagName("td")</p><p>            wks.Cells(i, j).Value = cell.innerText</p><p>            j = j + 1</p><p>        Next cell</p><p>        i = i + 1</p><p>    Next row</p><p>    MsgBox "Exchange rates imported successfully!", vbInformation</p><p>End Sub</p>]]></description>
         <enclosure url="" />
         <pubDate>2025-09-30 09:26:15 UTC</pubDate>
         <guid>https://padlet.com/nor97/z27kazz7jpy24fxc/wish/3611040898</guid>
      </item>
   </channel>
</rss>
