• 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

Problem with VBA Macro to scrape and validate IBANs and BICs in Excel|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / Problem with VBA Macro to scrape and validate IBANs and BICs in Excel|VBA & Macros|Excel Forum|My Online Training Hub

office scripts course

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 & MacrosProblem with VBA Macro to scrape an…
sp_PrintTopic sp_TopicIcon
Problem with VBA Macro to scrape and validate IBANs and BICs in Excel
Avatar
Goo Shikeda

New Member
Members
Level 0
Forum Posts: 1
Member Since:
May 27, 2021
sp_UserOfflineSmall Offline
1
May 27, 2021 - 10:30 pm
sp_Permalink sp_Print

Hi all,

I have a list of IBANs in Excel and wish to validate them via scraping data through VBA from this website: https://www.iban.com/iban-checker. In column A (cells A2:A3000), I have the IBANs and in column B I wish to see whether they are valid or not based on the IBAN Checker website.

It may be also worthwhile to extract/validate the BIC code in another column. Thus, would be glad to hear your opinion on this as well.

I have the following VBA code for the IBAN validation for now, which is not working, unfortunately:

Sub Iban()

Application.ScreenUpdating = False

Dim XMLPage As New MSXML2.XMLHTTP60
Dim htmldoc As New MSHTML.HTMLDocument
Dim htmlim As MSHTML.IHTMLElement
Dim htmlims As MSHTML.IHTMLElementCollection
Dim Sh As Worksheet
Dim URL As String
Dim sBody As String

Dim Iban As String

Set Sh = ThisWorkbook.Sheets("Sheet1")

uf = Range("F" & Rows.Count).End(xlUp).Row

' Sh.Range ("f2:F" & uf).ClearContents

URL = "https://es.iban.com/iban-checker"

For x = 2 To Range("A" & Rows.Count).End(xlUp).Row

Iban = Sh.Cells(x, 1).Value

sBody = "iban=" & Iban

XMLPage.Open "Post", URL, False
XMLPage.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
XMLPage.setRequestHeader "X-Requested-With", "XMLHttpRequest"

XMLPage.send sBody

htmldoc.body.innerHTML = XMLPage.responseText

Set htmlims = htmldoc.getElementsByTagName("strong")
For Each htmlim In htmlims
If htmlim.innerText = "VÁLIDO" Then
Sh.Cells(x, 2).Value = 100
End If
If htmlim.innerText = "Invalid IBAN check digit!" Then
Sh.Cells(x, 2).Value = 52323432
End If
Next htmlim

Next htmlim
Next

End Sub

Can you please help me with this? Thank you very much in advance.

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1844
Member Since:
November 8, 2013
sp_UserOnlineSmall Online
2
June 1, 2021 - 3:46 am
sp_Permalink sp_Print sp_EditHistory

It's not working because you have 3 Next statements, but only 2 For statements (duplicate closing statement):

Next htmlim

Next htmlim
Next

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Catalin Bombea, Riny van Eekelen, Nicholas Meyer, Manjula Mangalmurti, Rob Starren, Leigh Thomas
Guest(s) 9
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
jaryszek: 183
Newest Members:
Clare Webber
David Jenssen
Dominic Brosnahan
Young You
Jennifer Owens
Mohamed Touahria
Sheila McCall
Nicholas Montano
John Babcock
QSolutions Group
Forum Stats:
Groups: 3
Forums: 24
Topics: 6524
Posts: 28549

 

Member Stats:
Guest Posters: 49
Members: 32803
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.