View clear_cell_contents_on_click.vb
Option Explicit | |
Private Sub Worksheet_SelectionChange(ByVal Target As Range) | |
Target.FormulaR1C1 = "" | |
End Sub |
View dmikester1_mod.vb
'don't do this anymore: | |
DataBlock.SpecialCells(xlCellTypeVisible).Copy Destination:=Target.Cells(1, 1) | |
'instead try this: | |
Dim rngDestination As Range 'this should be way up at the top with all the other declarations | |
' ... all the other code | |
Set rngDestination = Target.Cells(1, 1) | |
DataBlock.SpecialCells(xlCellTypeVisible).Copy | |
rngDestination.PasteSpecial xlPasteType:=xlPasteValuesAndNumberFormats |
View CombineManyWorkbooksIntoOneWorksheet.vb
Option Explicit | |
Public Sub CombineManyWorkbooksIntoOneWorksheet() | |
Dim strDirContainingFiles As String, strFile As String, _ | |
strFilePath As String | |
Dim wbkDst As Workbook, wbkSrc As Workbook | |
Dim wksDst As Worksheet, wksSrc As Worksheet | |
Dim lngIdx As Long, lngSrcLastRow As Long, _ | |
lngSrcLastCol As Long, lngDstLastRow As Long, _ | |
lngDstLastCol As Long, lngDstFirstFileRow As Long |
View HighlightCorrespondingCells.vb
Option Explicit | |
Private Sub Worksheet_SelectionChange(ByVal Target As Range) | |
Dim wksLookups As Worksheet | |
Dim lngFirstRow As Long, lngLastRow As Long | |
'Get the Worksheet so we can confidently identify | |
'the Range that we'll be highlighting (if need be) | |
Set wksLookups = Target.Parent | |
View exampleEarlyBindingWithScriptingDictionary.vb
Dim dicCoolDictionary As Scripting.Dictionary | |
Set dicCoolDictionary = New Scripting.Dictionary | |
' then start assembling the dictionary |
View exampleEarlyBinding.vb
Dim variable as SomeObjectType | |
Set variable = New SomeObjectType |
View exampleLateBinding.vb
Dim variable as Object | |
Set variable = CreateObject("SomeObjectType") |
View TestCreateGUID.vb
Option Explicit | |
Public Sub TestCreateGUID() | |
'Dim t As Scriptlet.TypeLib <~ error, user type not defined | |
'Dim t As Scriptlet.IGenScriptletTLib <~ at least compiles | |
'Debug.Print t.Name <~ error, object or with block variable not set | |
' i.e. doesn't understand t as a variable | |
'Debug.Print t.GUID <~ same | |
'Debug.Print t.AnyOtherListedMethodOnThisObject | |
View CreateGUID.vb
Option Explicit | |
Public Function CreateGUID(Optional IncludeHyphens As Boolean = True, _ | |
Optional IncludeBraces As Boolean = False) _ | |
As String | |
Dim obj As Object | |
Dim strGUID As String | |
'Late-bind obj as a TypeLib -- a rare time when late-binding | |
'is actually a must! |
View combine_sheets_with_different_headers.vb
Option Explicit | |
Public Sub CombineSheetsWithDifferentHeaders() | |
Dim wksDst As Worksheet, wksSrc As Worksheet | |
Dim lngIdx As Long, lngLastSrcColNum As Long, _ | |
lngFinalHeadersCounter As Long, lngFinalHeadersSize As Long, _ | |
lngLastSrcRowNum As Long, lngLastDstRowNum As Long | |
Dim strColHeader As String | |
Dim varColHeader As Variant | |
Dim rngDst As Range, rngSrc As Range |
NewerOlder