All posts by Mahmoud Mostafa

The TextFrame Object in VBA with Examples

A TextFrame object is used to manipulate various elements of the text frame –basically a box of text — related to shape objects. When we have a shape object (ex. rectangle, circle, etc.), we can control the text associated with the shape through the TextFrame

How to use the RND Function in VBA

Introduction The RND function is used to generate a random number between 0 and 1. Generating a random number has applications in domains such as gambling, statistical sampling, computer simulation, or to — generally speaking — create unpredictable results for any other purpose. Of course,

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