Results 1 to 9 of 9

Modify VBA due to change in format of source web page

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-11-2024
    Location
    Chicago
    MS-Off Ver
    2021
    Posts
    116

    Modify VBA due to change in format of source web page

    I copy and paste data from a webpage. The webpage has changed its format. The macros formula I use to sort the data from webpage no longer works. Can someone please adjust the macros code to adjust to the new data format? I would like the data in Column A sorted into the format in cells in Columns C thru J. Thanks in advance!

    Option Explicit
    
    Sub sortdata()
    Dim a(), b()
    Dim i As Long, k As Long, lr As Long
    
        lr = Range("A" & Rows.Count).End(xlUp).Row
        
        a = Range("A1:A" & lr).Value
        ReDim b(1 To UBound(a, 1), 1 To 8)
      
        For i = 1 To UBound(a, 1) Step 25
            If a(i, 1) <> "Spread" Then Exit For
            k = k + 1
            b(k, 1) = a(i + 21, 1)
            b(k, 2) = a(i + 4, 1)
            b(k, 3) = a(i + 5, 1)
            b(k, 4) = a(i + 6, 1)
            b(k, 5) = a(i + 7, 1)
            b(k, 6) = a(i + 8, 1)
            b(k, 7) = a(i + 9, 1)
            b(k, 8) = a(i + 10, 1)
            
            k = k + 1
            b(k, 2) = a(i + 12, 1)
            b(k, 3) = a(i + 13, 1)
            b(k, 4) = a(i + 14, 1)
            b(k, 5) = a(i + 15, 1)
            b(k, 6) = a(i + 16, 1)
            b(k, 7) = a(i + 17, 1)
            b(k, 8) = a(i + 18, 1)
        Next
        Range("C2").Resize(k, UBound(b, 2)).Value = b
        Range("C2").Resize(k).NumberFormat = "h:mm AM/PM"
    End Sub
    MacroFix.xlsx
    Last edited by 6StringJazzer; 06-29-2025 at 04:15 PM. Reason: better titles please

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. A Small Tweak
    By MrJingles in forum Excel General
    Replies: 3
    Last Post: 06-02-2017, 09:14 AM
  2. [SOLVED] I need a tweak with Macros, getting error because of zero value for my IF condition...
    By lati2008 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-12-2014, 01:41 AM
  3. Holiday DB Tweak
    By jj72uk in forum Access Tables & Databases
    Replies: 0
    Last Post: 08-31-2009, 11:17 AM
  4. Macro Tweak
    By teeb in forum Excel General
    Replies: 2
    Last Post: 11-13-2006, 03:16 AM
  5. Code Tweak
    By bodhisatvaofboogie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-21-2006, 11:40 AM
  6. Can someone please tweak my Macro?
    By Wibs in forum Excel General
    Replies: 3
    Last Post: 12-15-2005, 01:15 PM
  7. One more final tweak...
    By M. Stanley in forum Excel General
    Replies: 3
    Last Post: 01-14-2005, 08:06 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