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 main(workbook: ExcelScript.Workbook) { | |
console.log("Checking for existance of Worksheet: 'vInfo'") | |
let infoSheet = workbook.getWorksheet("vInfo"); | |
let toolsSheet = workbook.getWorksheet("vTools"); | |
if (toolsSheet) { | |
console.log(workbook.getName() + " has vTools sheet"); | |
let existTable = toolsSheet.getTable("tblVTOOLS"); | |
if (!existTable) { | |
console.log("'tblVTOOLS' was not found -- creating now"); | |
let newTable = workbook.addTable(toolsSheet.getUsedRange(), true); |
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
UpdateContext({tbl1:ForAll(Filter(v3ProjectLog_Access,EntraId=Text(User().EntraObjectId)),'Log Area')}) | |
//RETURNS OBJECT:Table, SINCE LOG AREA IS A LookUp, TABLE CONTAINS Id, VALUE COLUMNS |
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
' Gist Link: https://gist.github.com/lopperman/622b5b20c2b870b87d9bd7606d3326f6 | |
' ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ' | |
' author (c) Paul Brower https://github.com/lopperman/just-VBA | |
' license GNU General Public License v3.0 | |
' ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ' | |
'' REF: https://learn.microsoft.com/en-us/office/vba/api/excel.application.automationsecurity | |
'' Application.AutomationSecurity returns or sets an MsoAutomationSecurity constant | |
'' that represents the security mode that Microsoft Excel uses when | |
'' programmatically opening files. Read/write. | |
'' Excel Automatically Defaults Application.AutomationSecurity to msoAutomationSecurityLow |
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
''This Formula takes a single row of values, and returns the first range column index in a range for each corresponding column | |
''Excel Lambda Function - Return Column Indexes of Matched Criteria | |
''This Formula takes a single row of values, and returns the first range column index in a range for each corresponding column | |
''e.g. given a worksheet with the following values | |
'' A B C D E F | |
''1 | |
''2 2 4 1 1 2 0 | |
''3 1 2 0 | |
''4 2 3 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
' []r/VBA -Article](https://www.reddit.com/r/vba/comments/w7cmm3/check_correctly_if_something_is_an_array_and_if/?utm_source=share&utm_medium=web2x&context=3) | |
' ~~~ Test if anything is and ARRAY ~~~ | |
Public Function ValidArray(tstArr As Variant) As Boolean | |
Dim vt As Long: vt = VarType(tstArr) | |
Dim compare As Long | |
compare = vt And VbVarType.vbArray | |
ValidArray = compare <> 0 | |
End Function | |
' ~~~ Check if array has been initialized (can read or set values) ~~~ |
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
'POSTED WITH THIS ARTICLE ON REDDIT https://www.reddit.com/r/vba/comments/w74j85/handy_stringsmatch_method_that_handles_equal_not/?utm_source=share&utm_medium=web2x&context=3 | |
Public Enum strMatchEnum | |
smEqual = 0 | |
smNotEqualTo = 1 | |
smContains = 2 | |
smStartsWithStr = 3 | |
smEndWithStr = 4 | |
End Enum |
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
Dim rng as Range: set rng = ThisWorkbook.Worksheets("your sheet name").Range("C6") | |
If GetFoundTextSheetRows(rng, ecOr, "apple", "application").Count = 1 Then | |
'delete the row | |
End If | |
Option Explicit | |
Public Enum ecCompType | |
ecOR = 0 'default |
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
<-- does one need a reason | |
<-- same code, less vanity |
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 Function ExportSheetAsPDF(ws As Worksheet, fileName As String) | |
Dim saveDir As String | |
If Len(fileName) > 4 Then | |
If InStr(1, Right(fileName, 4), ".pdf", vbTextCompare) = 0 Then | |
fileName = fileName & ".pdf" | |
End If | |
End If | |
saveDir = ChooseFolder("select folder to save") | |
If Len(saveDir) > 0 Then |
NewerOlder