All posts by Mahmoud Mostafa

How to Use CountIf in VBA

In Excel, the function CountIf is used to count how many times a condition has been met within a worksheet range. However, to use this function while writing VBA code, we need to change it from CountIf to WorksheetFunction.CountIf. The full syntax of the function

scraping from wikipedia

GetElementById in VBA

Visual Basic for Applications allows you to get data and information from websites. This is called ‘web scraping’. Web pages are written in a markup language called HTML. Anything that interests you in a webpage can be retrieved once we know which HTML element it

else without if error popup

Else Without If Error in VBA: Why Is it Happening?

What you’re seeing is a compile error that indicates that an Else (or ElseIf) keyword was not preceded by a correct If statement. Meaning, the compiler found an Else statement (which it will highlight for the user) without seeing an If statement in the lines