what does "xl" prefix mean in vba

Regular Visitor

below is a line of VBA code, I am just a beginner and trying to understand the "xl" prefix.

 

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _

:=False, Transpose:=False

1 Reply

@Mick_X 

The values of the Paste and Operation arguments are numbers.

For example, to paste everything, you could use Paste:=-4104, and to paste values only, you could use Paste:=-4163.

Since it's difficult to memorize and understand such numbers, Excel VBA provides so-called symbolic constants. You can use xlPasteAll instead of -4104 and xlPasteValues instead of -4163. They make the code much easier to read.

Symbolic constants that are common to VBA in general begin with vb, for example vbYes.

Symbolic constants that are specific to Excel begin with xl.

(There are also symbolic constants for VBA in Word, beginning with wd, in PowerPoint, beginning with pp, etc.)