Skip to content

Instantly share code, notes, and snippets.

@ijd65
ijd65 / Rename Subject
Created July 17, 2013 07:33
Renames the subject of the selected Outlook email
Private Sub Rename()
'Dim olTask As Outlook.TaskItem
'Using object so all items can be processed
Dim olitem As Object
Dim olExp As Outlook.Explorer
Dim fldCurrent As Outlook.MAPIFolder
Dim olApp As Outlook.Application
@ijd65
ijd65 / Merge Down
Created July 25, 2013 00:24
Merge Excel worksheets - Down Run from the worksheet you wan the merged data to be pasted to
Sub Merge_Down()
Dim ws As Worksheet
ActiveSheet.UsedRange.Offset(0).Clear
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> ActiveSheet.Name Then
ws.UsedRange.Copy
Range("A65536").End(xlUp).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
@ijd65
ijd65 / Merge Across
Created July 25, 2013 00:27
Merge multiple worksheets across the worksheet - specify range to be copied in the set copy range parameter
Sub Merge_Across()
Dim sh As Worksheet
Dim DestSh As Worksheet
Dim Last As Long
Dim CopyRng As Range
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
@ijd65
ijd65 / Last Row
Created July 25, 2013 00:29
Function to find the last row of a worksheet
Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
@ijd65
ijd65 / Copy Range
Created July 25, 2013 00:33
Copy a specified range from multiple worksheets into a master worksheet
'Fill in the range that you want to copy
'Set CopyRng = sh.Range("A1:G1")
Sub CopyRangeFromMultiWorksheets()
Dim sh As Worksheet
Dim DestSh As Worksheet
Dim Last As Long
Dim CopyRng As Range
With Application
@ijd65
ijd65 / Wipe Row if Text not found
Created July 29, 2013 01:10
This will wipe the row if specified text is not found in a particular column
Public Function GetLastRow(ByVal rngToCheck As Range) As Long
Dim rngLast As Range
Set rngLast = rngToCheck.Find(what:="*", searchorder:=xlByRows, searchdirection:=xlPrevious)
If rngLast Is Nothing Then
GetLastRow = rngToCheck.Row
Else
GetLastRow = rngLast.Row
@ijd65
ijd65 / Access Warnings
Last active January 15, 2018 08:36
Turn off error /result display
DoCmd.SetWarnings (False)
DoCmd.SetWarnings (True)
@ijd65
ijd65 / Infopath Form Window Name
Created August 15, 2013 03:06
Sets the window of the Infopath form to the name you specify
function XDocument::OnSwitchView(eventObj)
{
XDocument.View.Window.Caption = "Name of Form";
}
@ijd65
ijd65 / Hidden Text
Created August 29, 2013 12:56
Hide text on page for Google search engine, replace ... with required text
<div style="display:none">...</div>
@ijd65
ijd65 / Delete Row based on conditions
Created September 4, 2013 03:30
Delete Row based on multiple criteria Change Sheet(1) to required Sheet
Sub DeleteRows()
Dim x As Long
With Sheets(1)
For x = .UsedRange.Rows.Count To 2 Step -1
If .Cells(x, 1) < 0.2 And .Cells(x, 2) > 0.3 And .Cells(x, 3) > 10 Then
.Rows(x).Delete
End If
Next
End With
End Sub