Friend Procedure

Friend procedures cannot be used in standard modules.
A procedure defined as a friend allows the procedure to be called from modules that are outside the class, but part of the project within which the class is defined.
It sits between Public and Private.
It makes a method accessible to your entire VBA project, but completely hidden from external programs or users interacting with your workbook.
This modifies the definition of a procedure in a class module to make the procedure callable from modules that are outside the class.
Friend procedures cannot be used in standard code modules
The Friend keyword can be used for variables and methods declarations with an class module or userform module
Friend scope allows other modules within the same project to access these variables or methods.
This scope it different to Public because public variables and methods are exposed outside of the current project.


This cannot be applied to fields, only methods and properties.
This is code inside a class module.

Private Sub MySecretMethod() 
' Only code INSIDE this Class can see or run this.
End Sub

Friend Sub MyProjectMethod()
' Any standard module in THIS VBA project can see and run this.
' External Excel files or Add-ins referencing this file CANNOT see it.
End Sub

Public Sub MyUniversalMethod()
' Everyone and everything can see and run this.
End Sub

© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext