• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member
  • Login

Web Scraping with VBA|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / Web Scraping with VBA|VBA & Macros|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosWeb Scraping with VBA
sp_PrintTopic sp_TopicIcon
Web Scraping with VBA
Avatar
Al El Yamak
Member
Members
Level 0
Forum Posts: 7
Member Since:
December 3, 2022
sp_UserOfflineSmall Offline
1
December 3, 2022 - 9:23 am
sp_Permalink sp_Print

 I am reading the list of cars from Craigslist Miami using VBA. The code is working fine with printing the links for each vehicle and price. The only issue when I select a different city for instance, Los Angeles, the URL sysntax changes and I am not sure how to read the class name. Code below works fine for Miami link (in the code), but does not work for this link: https://losangeles.craigslist......1~list~1~0

Please see attached.

 

Thank you for helping.

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1550
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
2
December 5, 2022 - 10:41 am
sp_Permalink sp_Print sp_EditHistory

Crossposted here

excel - How Can I Extract list of prices from website using VBA? - Stack Overflow

 

Please read these Forum Rules

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1550
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
3
December 13, 2022 - 9:07 am
sp_Permalink sp_Print

Hi,

Have you tried using the updated code provided on Stack Overflow?  I tried it and it looks like it works.  You just need to incorporate your original code loop or each location you want to get data from.

I don't see that the url changes beyond the location name at the start or the URL so it's no different to dealing with different page numbers for each page of search results.

Phil

Avatar
Al El Yamak
Member
Members
Level 0
Forum Posts: 7
Member Since:
December 3, 2022
sp_UserOfflineSmall Offline
4
December 21, 2022 - 11:26 am
sp_Permalink sp_Print

Hi Phil - Sorry for the delayed response.

I tried the code on Stack Overflow, but it s super slow. My original code in the file I shared is very fast and works exactly how I want it.  I was thinking if I can use a Case Statement with expression checks the format of the URL. I just need to figure out how to update the URL Syntax, class names, etc..

It would be great if you can take a look at file attached.

 

Thanks

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1550
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
5
December 21, 2022 - 12:28 pm
sp_Permalink sp_Print

Hi,

nothing attached.  You need to click Start Upload after selecting the file, then wait for it to upload.

Phil

Avatar
Al El Yamak
Member
Members
Level 0
Forum Posts: 7
Member Since:
December 3, 2022
sp_UserOfflineSmall Offline
6
December 21, 2022 - 11:31 pm
sp_Permalink sp_Print

Hello - Can you please check now?

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Riny van Eekelen, Lorna Henning
Guest(s) 8
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 880
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 237
Jessica Stewart: 219
A.Maurizio: 213
Aye Mu: 201
Hans Hallebeek: 185
Newest Members:
Appiagyei Kofi Frimpong
Hilary Burchfield
Richie Wright
Adel Kock
Barbara Murray
Doug Milne
Siobhan Stringer
Rob Rooth
Tom Lewis
Jennifer Rodriguez-Avila
Forum Stats:
Groups: 3
Forums: 24
Topics: 6542
Posts: 28639

 

Member Stats:
Guest Posters: 49
Members: 32829
Moderators: 2
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel Office Scripts
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook

Sign up to our newsletter and join over 400,000
others who learn Excel and Power BI with us.

 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate
  • Sponsor Our Newsletter

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.