This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' ---------------------------------------------------------------- | |
' Function: ReturnColumnLetter | |
' Purpose: Given a column number, returns the letter as a string | |
' Params: col_num: Integer: the column number to convert | |
' Author: Gray | |
' Date: 1/19/2021 | |
' ---------------------------------------------------------------- | |
Function ReturnColumnLetter(ByVal num As Integer) As String | |
ReturnName = Split(Cells(, num).Address, "$")(1) | |
End Function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void txtSearch_KeyDown(object sender, KeyEventArgs e) | |
{ | |
if (e.KeyCode == Keys.Enter) | |
{ | |
searchDb(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'--------------------------------------------------------------------------------------------------- | |
'Sub: InsertVlookup | |
'Purpose: Runs a vlookup with given parameters and formats as values and sets column width | |
' removes both errors & 0's | |
'Example call: InsertVlookup "O", "B6", "NotesHistory!$B:$J", "9", 30 | |
'--------------------------------------------------------------------------------------------------- | |
Public Sub InsertVlookup(destination_column_letter As String, lookup_cell As String, lookup_range As String, return_index As String, colum_width As Long) | |
Dim column_range As Range | |
Set column_range = notes_sheet.Range(destination_column_letter & FIRST_DATA_ROW & ":" & destination_column_letter & last_used_row) | |
With column_range |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Sub ClearAllFilters() | |
Dim ws As Worksheet | |
For Each ws In ThisWorkbook.Worksheets | |
ws.ShowAllData | |
Next ws | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'EXAMPLE CALL: | |
' To clipboard: | |
' Dim string_to_copy As String: string_to_copy = ThisWorkbook.Worksheets("Sheet1").Range("A1").Value | |
' Clipboard (string_to_copy) | |
' From clipboard: | |
' Dim in_clipbaord As String | |
' in_clipboard = Clipboard() | |
'------------------------------------------------------------------ | |
' Function: Clipboard | |
' Purpose: Read from (if no variable passed) or write variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Sub CopyUsedRangeFromExternalWBToTable(source_ws_number As Long, wb As Workbook, dest_sheet As String, dest_range As String) | |
wb.Worksheets(source_ws_number).UsedRange.Copy | |
ThisWorkbook.Worksheets(dest_sheet).Range(dest_range).PasteSpecial Paste:=xlPasteValues | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' ---------------------------------------------------------------- | |
' Function: ChooseExcelFile | |
' Purpose: Get the location of the chosen excel file from dialog | |
' Params: String: starting_path: The folder to open the dialog in | |
' example: Environ$("USERPROFILE") & "\Downloads" or | |
' example2: C:\Data (no ending \) | |
' Returns: String: The full path to the chosen excel file as string | |
' By: HG | |
' Date: 12/21/2021 | |
' ---------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' ---------------------------------------------------------------- | |
' Function: IsValueInList | |
' Purpose: Pass in a search term and function will tell you if it's in the given table. | |
' Assumptions: There is a named single-column Excel Table Object in the given worksheet | |
' Params: | |
' searchTerm: String: the item to look for in the list | |
' sheet: String: the sheet name where the lookup table is located | |
' list: String: the name of the Excel Table object where we want to look for the searchTerm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Stores the value of the selected cell in a variable | |
Dim prevValue As String | |
Private Sub Worksheet_SelectionChange(ByVal Target As Range) | |
Dim prevValue As String | |
On Error Resume Next | |
If Intersect(Target, Range("G:K")) Is Nothing Then | |
prevValue = "" | |
Else | |
prevValue = Target.Value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'---------------------------------------------------------------------------------- | |
' Function: ValueInTable | |
' Purpose: Given a list object and column number, look up the given value | |
' in a column and return "True" if found | |
' Params: column_number Long the columns number to find the value in | |
' (this number is relative to the beginning | |
' of the data body range of the list object, | |
' not the total number of columns in the sheet) | |
' tbl ListObject The listobject to search | |
' LookupValue String The value to find |
NewerOlder