Skip to main content

Posts

Parsing Text with Regex (Function)

Hello Everyone, This time, I have come up with another VBA code which parses the required stuff in the braces (.*) (assuming reader knows basis Regular Expression syntax). So straightaway, here is the code :- Function RegParse(ByVal pattern As String, ByVal html As String) Dim regex As RegExp Set regex = New RegExp With regex .IgnoreCase = True 'ignoring cases while regex engine performs the search. .pattern = pattern 'declaring regex pattern. .Global = False 'restricting regex to find only first match. If .Test(html) Then 'Testing if the pattern matches or not mStr = .Execute(html)(0) '.Execute(html)(0) will provide the String which matches with Regex RegParse = .Replace(mStr, "$1") '.Replace function will replace the String with whatever is in the first set of braces - $1. Else RegParse = "#N/A"

Search functionality using Advanced Filter Technique through VBA

Hello Every One, This time I have come up with another VBA  trick which could be used as a replacement for traditional Index(table,Small(if(Column = Criteria, RowNum),nth)) constructions. This is much efficient than any way around based on Excel general Functions like I have stated earlier. So, for the sake explanation, there are two sheets. One is a Master Sheet which would contain Data in the form of a table having different Headings which could be used as criteria either individually or otherwise. Second sheets is an Extract sheet where data would be pulled from Master sheet based on Some criteria placed in the Extract sheet itself. here are some pictures of Master sheet layout and Extract Sheet.

Making Dynamic Formatted tables using Conditional Formatting

Hello Everyone, This time I have come up with another conditional formatting trick. The Trick is to make Formatted & Bordered tables without using any VBA Code and that too are Dimensionally Dynamic. It means you can add as many rows and columns as you want, just by changing the rows and columns attributes by changing Reference cells as you can see in the above picture. So here are the steps:-

Automation:- Sending Invitation to Meeting Using Excel VBA

Hello Everyone, In one of the previous post, I wrote about automating Sending Emails using Excel VBA. This time I have come up with a pretty similar code. The code below sends Outlook Meeting Invitations to recipients on one click. here is the Code:- Sub Send_Invite_Auto() Dim olApp As Outlook.Application Dim olApt As AppointmentItem Set olApp = New Outlook.Application 'Creating Outlook Session Set olApt = olApp.CreateItem(olAppointmentItem) 'Creating an Appointment With olApt .Subject = "Enter the subject here." 'Subject .Start = DateAdd("d", 5, Now) 'Enter Date + Time here. .Recipients.Add ("example@gmail.com") 'Recipient Name, Alias, or any other Attribute. .MeetingStatus = olMeeting 'olAppointmentItem with Meeting status olMeeting 'becom

Making Password Protected PDFs using Excel Vba and PDFtk Tool

Hi Everyone, This time, I have come up a VBA Code to generate Password protected PDFs using Excel. Actually, Excel Vba has .ExportAsFixedFormat Method to generate PDFs but this hasn't any Parameter which takes password to protect the PDFs. So I have used PDFtk Tool which provide Command Line Interface to make PDFs protected using Password. Actually, You can do various things using PDFtk Tool command line varying from creating, merging, Protecting and many other. So Download the PDFtk Tool from the following link:- Download PDFtk Tookit Here are the Steps:- 1. Install the PDFtk Toolkit. 2. Use the following code to Print or Export the Activesheet with a password.

Maximum Consecutive wins OR How maximum times, an Event has occurred Consecutively (Using Frequency Function)

Hi Everyone, This time, I have come up an excel function which will give you maximum consecutive Wins count for different teams. To be more precise, this article is gonna be about finding maximum consecutively occurring event OR we can say that how maximum times, an event has consecutively occurred. The Function I have used, uses Frequency function in its core. To start with explaining the Win part, I have used following Formula to calculated consecutive wins count for team Say India:-

Merging a particular Worksheet from Multiple Workbooks into one Worksheet (Skipping Heading Row, Hidden and Blank Rows)

Hello Everyone, This time, I have come up with a code which will merge a particular sheet from Multiple Workbooks in a folder, into one Worksheet. While doing so, it will ignore Row 1st i.e. header row, Hidden and Blank Rows. So before using code, make sure following things:- 1. Change fPath variable in the code to an appropriate Folder Path holding all Input sheets. 2. Make a suitable heading row to match with those in the Input sheets. 3. Actually this code will paste copy data from Current Input sheet and paste it beneath the data imported from Former Input Sheet. 4. If you want more sheets to be imported then you can simply put those worksheets in the fPath folder after getting Former Imported Sheets out of the fPath folder. It will avoid Duplication as Code pastes data in the next of the last filled row and Former sheets will not be considered again.