Skip to content

Instantly share code, notes, and snippets.

danwagnerco /
Last active January 7, 2024 15:04
WifeyAlpha recommended reading
danwagnerco /
Last active April 30, 2023 10:42
Wifey Alpha Research Thread 2022-01-16
danwagnerco /
Created January 28, 2022 02:48 — forked from ih2502mk/
Quantopian Lectures Saved
danwagnerco / clear_cell_contents_on_click.vb
Created April 14, 2017 17:50
Placed in the Worksheet you'd like this mode to work in, you can clear cell contents by simply clicking the cell, which allows for instant editing
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Target.FormulaR1C1 = ""
End Sub
danwagnerco / dmikester1_mod.vb
Created March 29, 2017 20:01
small adjustment
'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)
rngDestination.PasteSpecial xlPasteType:=xlPasteValuesAndNumberFormats
danwagnerco / CombineManyWorkbooksIntoOneWorksheet.vb
Last active May 16, 2019 16:51
This VBA macro combines data from many workbooks in a single folder into a single worksheet
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
danwagnerco / HighlightCorrespondingCells.vb
Created October 15, 2016 15:44
This macro will highlight cells in column G based on the selection in column A
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
danwagnerco / exampleEarlyBindingWithScriptingDictionary.vb
Created October 2, 2016 21:30
an example of early-binding in VBA (with the Scripting.Dictionary object, a personal favorite)
Dim dicCoolDictionary As Scripting.Dictionary
Set dicCoolDictionary = New Scripting.Dictionary
' then start assembling the dictionary