https://www.c-sharpcorner.com/article/how-to-use-modernui-framework-in-windows-forms/
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 RefreshPivotCache() | |
Dim ws As Worksheet | |
Dim PT As PivotTable | |
For Each ws In ActiveWorkbook.Worksheets '<~~ Loop all worksheets in workbook | |
For Each PT In ws.PivotTables '<~~ Loop all pivot tables in worksheet | |
PT.PivotCache.Refresh | |
Next PT | |
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
Function StringCountOccurrences(strText As String, strFind As String, _ | |
Optional lngCompare As VbCompareMethod) As Long | |
' Counts occurrences of a particular character or characters. | |
' If lngCompare argument is omitted, procedure performs binary comparison. | |
'Testcases: | |
'?StringCountOccurrences("","") = 0 | |
'?StringCountOccurrences("","a") = 0 | |
'?StringCountOccurrences("aaa","a") = 3 | |
'?StringCountOccurrences("aaa","b") = 0 | |
'?StringCountOccurrences("aaa","aa") = 1 |
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
using System.IO; | |
string connection_string = File.ReadAllText(@"C:\Data\ConStringNoCred.txt"); |
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 GetStringFromFile(filepath As String) As String | |
On Error GoTo 0 | |
Dim iFile As Integer: iFile = FreeFile | |
Open filepath For Input As #iFile | |
GetStringFromFile = Input(LOF(iFile), iFile) | |
Close #iFile | |
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: DeleteBlankSheets | |
' Purpose: Deletes all blank sheets in workbk | |
' Params: workbk: Workbook: The workbook to delete the sheets in | |
' Last Update: 2/1/2021 | |
' Author: Gray | |
'----------------------------------------------------------------- | |
Public Sub DeleteBlankSheets(ByVal workbk As Workbook) | |
Dim sh As Worksheet |
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 |