+ Reply to Thread
Results 1 to 7 of 7

VBA Code to Open Webpage, Select All, Paste to Excel

  1. #1
    Registered User
    Join Date
    08-15-2011
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    78

    VBA Code to Open Webpage, Select All, Paste to Excel

    Hi all,

    I'm trying to create a simple VBA code that will open up a web link that as text (not hyperlink) I have in cell A1, select all data on the web page, then paste to the workbook (Sheet1, cell b1), pasting as "Match Destination Formatting".
    I've tried google for the answer but I'm not very experienced with VBA and hence not getting very far.

    Any help would be appreciated.
    Thanks !

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,903

    Re: VBA Code to Open Webpage, Select All, Paste to Excel

    Are you still running Excel 2003 or a later version. If a later version, please update as that will make a potential difference in a solution.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    08-15-2011
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    78

    Re: VBA Code to Open Webpage, Select All, Paste to Excel

    I'm running the latest version at 64-bit, thanks.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,903

    Re: VBA Code to Open Webpage, Select All, Paste to Excel

    Please update your profile to reflect the current version you are running. It makes a big difference in how people answer your needs as newer versions have features that the older versions do not. Will relook at your needs and will try to find a solution.

    Also, are you able to share a web site that you are looking to import for? And what data do you want from that site?
    Last edited by alansidman; 07-31-2019 at 06:42 PM.

  5. #5
    Registered User
    Join Date
    08-15-2011
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    78

    Re: VBA Code to Open Webpage, Select All, Paste to Excel

    Thanks for the feedback. I've changed my profile.

    Here is an example of the webpage(s) I will be trying to grab data from :

    https://racing.hkjc.com/racing/infor...se=ST&RaceNo=1

    Currently my manual process is to open the page in Internet Explorer, click Ctrl+A, Ctrl+C the paste into Excel (Match Destination Formatting). So I'm trying to come up with some VBA code that will automate this process. Once I have the basic code, I should be able to amend it to reference whichever different webpage I need.

    Hope this makes sense.....thanks.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,903

    Re: VBA Code to Open Webpage, Select All, Paste to Excel

    Using Power Query/Get and Transform you should be able to open the web site and download the tables and then load them to your spreadsheet. If you have not used PQ, click on the links regarding PQ that are in my signature block in my first post in this thread. You can manipulate the data that you down load in PQ if needed.

  7. #7
    Registered User
    Join Date
    08-15-2011
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    78

    Re: VBA Code to Open Webpage, Select All, Paste to Excel

    I'll check it out 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. Replies: 8
    Last Post: 11-25-2015, 08:14 PM
  2. [SOLVED] Use VBA to Automate Actions on Webpage (Open web page, Select Dropdown, click button)
    By ravikiran in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-03-2015, 07:29 AM
  3. Need VBA Code to open webpage link list from excel
    By devanand.sankar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-30-2014, 06:09 AM
  4. VBA-code in excel to open webpage and log in to web page
    By molle in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-10-2013, 07:41 AM
  5. [SOLVED] Macro to paste code from webpage into excel
    By Priya24 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-13-2012, 10:48 AM
  6. Code to select, and then open CSV file into an Excel sheet
    By Rschwar2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-24-2012, 05:55 PM
  7. [SOLVED] VBA code to 'click' Open in the Open or Save dialogue box on a webpage?
    By bensox in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-31-2012, 05:40 AM

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