Skip to content

Instantly share code, notes, and snippets.

View walkergv's full-sized avatar

Glenn Walker walkergv

View GitHub Profile
@walkergv
walkergv / Proper Upper Lower Case Excel Macro
Last active June 5, 2019 13:15
Excel Macros For Making Text In Cells Upper, Lower and Proper Case
'Code for Upper Case
Sub UpperCase()
Dim objCell As Object
For Each objCell In Selection
objCell.Value = UCase(objCell.Formula)
Next
End Sub
'Code for Lower Case
@walkergv
walkergv / Make Modified Broad Match
Last active December 16, 2015 21:09
A Simple VBA Excel User Defined Function for adding modified broad match plus signs onto keywords . Also contains a TRUE or FALSE modifier to remove any common word (eg. the, a, for, etc...)
Function MakeModifiedBroadMatch(rng As Range, RemoveCommonWords As Boolean) As String
Dim WordList() As String
Dim CommonWords() As String: CommonWords = Split("how,do,i,with,in,a,to,the,for,is,of,and,are", ",")
Dim i As Integer
Dim x As Integer
Dim ContainsCommonWord As Boolean
Dim ModifiedBroadMatchKeyword As String
WordList = Split(rng.Value)
@walkergv
walkergv / Find and Show Word Matches
Created May 13, 2013 22:28
VBA User Defined Function for finding keyword Matches in a keyword by looking through a list of available keywords.
Function ShowMatch(Keyword As String, ByVal MyRange As Range) As String
Dim Delimiter As String: Delimiter = "-"
Dim Temp As String: Temp = ""
For Each Row In MyRange.Rows
For Each cell In Row.Cells
If InStr(Keyword, cell) > 0 Then
Temp = Temp + Delimiter + cell
End If
Next cell
Next Row
@walkergv
walkergv / Category to Sheet
Last active July 5, 2023 21:40
A VBA Excel Macro that processes an Excel Table with a category column (must be first column) and applies several sorts, filters and styling. Also it creates a linked table of contents of worksheets in the excel workbook.
Sub CategoryToSheet()
Dim rng As Range
Dim Category As Range
Dim List As New Collection
Dim Item As Variant
Dim i As Integer
Dim rngLinkCell As Range
Dim strSubAddress As String
Dim strDisplayText As String
'
@walkergv
walkergv / php-UA.php
Last active May 20, 2022 09:04
Simple Event Tracking with Measurement Protocol Using cURL and PHP (plus redirect)
<?
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'http://www.google-analytics.com/collect?v=1&tid=[UA-XXXXXXXXX-1]&cid=[RANDOM_INTEGER_OR_GUID]&t=event&ec=[EVENT_CATEGORY]&ea=[EVENT_ACTION]&el=[EVENT_LABEL]',
CURLOPT_USERAGENT => 'Vanity-URL-Tracker',
));
$resp = curl_exec($curl);
curl_close($curl);
header("HTTP/1.1 301 Moved Permanently");
@walkergv
walkergv / gtm-userscript.js
Last active August 29, 2015 14:01
google tag manager (gtm) userscript for tampermokey
// ==UserScript==
// @name Google Tag Manager Test Script
// @namespace http://www.tikodigital.com/
// @version 0.1
// @description Code to Run Google Tag Manager Client Side
// @include *domain.com*
// @copyright 2014 Tiko Digital
// ==/UserScript==
var actualCode = '(' + function() {
@walkergv
walkergv / .htaccess
Last active August 29, 2015 14:06
Redirect to www version of the site.
########## - BEGIN - remove www version of site
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
########## - END - www.version of site
@walkergv
walkergv / listallfiles.googleappscript.js
Created January 26, 2015 21:06
Export a List of Google Sheets in a Google Drive Folder
function listFilesInFolder(folderName) {
var folder = DocsList.getFolder(folderName);
var contents = folder.getFiles();
var file, data, rows = [];
for (var i = 0; i < contents.length; i++) {
file = contents[i];
@walkergv
walkergv / createdocfromsheet.appscript.js
Created January 29, 2015 05:38
Create and Format a Google Doc from Google Sheet
function createDoc() {
//
// Get The Current Spreadsheet
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = spreadsheet.getActiveSheet();
//
// Get data in spreadsheet
var range = sheet.getDataRange();
var rowsData = range.getValues();
//
@walkergv
walkergv / runReport.appscript.js
Created January 29, 2015 05:42
Pass in your Google Analytics Profile Id and use GA Reporting API to get information and output to spreadsheet.
function runReport(profileId) {
var today = new Date();
var oneWeekAgo = new Date(today.getTime() - 30 * 24 * 60 * 60 * 1000);
var startDate = Utilities.formatDate(oneWeekAgo, Session.getScriptTimeZone(),
'yyyy-MM-dd');
var endDate = Utilities.formatDate(today, Session.getScriptTimeZone(),
'yyyy-MM-dd');
var tableId = 'ga:' + profileId;