Skip to content

Instantly share code, notes, and snippets.

View saurabhkaul's full-sized avatar
🤠

Saurabh Kaul saurabhkaul

🤠
View GitHub Profile
@saurabhkaul
saurabhkaul / Regex_Extract_VBA
Created July 31, 2018 07:23
Simple VBA subroutine I wrote for excel in VBA that could extract a pattern(Indian pin code in this case) and output the multiple selections in a column using regex
Private Sub simpleRegex()
Dim strPattern As String: strPattern = "\d{6}" 'Define regex pattern here
Dim Match As Object
Dim matches As Object
Dim regex As Object
Set regex = CreateObject("VBScript.RegExp")
Dim strInput As String
Dim Myrange As Range
Set Myrange = ActiveSheet.Range("A1:A200") 'Define the range of column you want the regex to work on