Start

'ログ出力1(引数) Public Sub LogInfo1(str As String) Call LogInfo2(Now, str) End Sub 'ログ出力2(引数) Public Sub LogInfo2(key As String, value As String) Call LogInfo3(key, value, ":") End Sub 'ログ出力3(引数) Public Sub LogInfo3(key As String, value As String, regx As String) Debug.Print key & regx & value End Sub

'Screen解除 Public Sub ScreenUpdateFalse() Application.ScreenUpdating = False End Sub 'Screenロック Public Sub ScreenUpdateTrue() Application.ScreenUpdating = True End Sub 'シート表示 Public Sub SheetShow(sht As Worksheet) If sht.Visible = xlSheetHidden Then sht.Visible = xlSheetVisible End If End Sub 'シート非表示 Public Sub SheetHide(sht As Worksheet) If sht.Visible = xlSheetVisible Then sht.Visible = xlSheetHide End If End Sub 'ブッククローズ(保存) Public Sub BookCloseforSaveTrue(wk As Workbook) wk.Close saveChanges:=True End Sub 'ブッククローズ(非保存) Public Sub BookCloseforSaveFalse(wk As Workbook) wk.Close saveChanges:=False End Sub '前行のフォーマットのコピー Public Sub CopyFormat(sht As Worksheet, targetRow As Long) sht.Rows(targetRow - 1).Select Selection.Copy sht.Rows(targetRow).Select Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False End Sub 'フォーカスの設定(A1) Public Sub SetFocusA1(sht As Worksheet) sht.Range("A1").Select sht.Range("A1").Activate End Sub

'頭文字の判断 Public Function StartsWith(str As String, startStr As String) As Boolean If Len(Trim(startStr)) > Len(Trim(str)) Or Len(Trim(startStr)) = Len(Trim(str)) Then StartsWith = False Else StartsWith = Left(str, Len(startStr)) = startStr End If End Function '指定数字の頭3ゼロの補足 Public Function FormatToLeft3Zero(number As Long) As String FormatToLeft3Zero = Format(number, "000") End Function '本文を「・」で区切 Public Function StrSpilt(str As String) As Variant Dim strs As Variant Dim newArr As Variant Dim ifor As Long strs = Split(str, "・") If IsEmpty(strs) Or UBound(strs) = 0 Then StrSpilt = Array() Exit Function End If ReDim newArr(UBound(strs) - 1) For ifor = 1 To UBound(strs) newArr(ifor - 1) = RemoveTrailingNewlinesRegex("・" & CStr(strs(ifor))) Next ifor StrSpilt = newArr End Function '指定列の最後行の番号取得 Public Function GetLastRow(colNum As String) As Integer GetLastRow = Common.GSheet.Cells(Common.GSheet.Rows.Count, colNum).End(xlUp).Row End Function '指定文字の含め判断 Public Function ContainsStr(mainString As String, substring As String) As Boolean ContainsStr = InStr(1, mainString, substring, vbTextCompare) > 0 End Function '改行文字の除く Public Function RemoveTrailingNewlinesRegex(str As String) As String Set regex = CreateObject("VBScript.RegExp") With regex .Global = True .Pattern = "\r?\n?$" End With If regex.test(str) Then str = regex.Replace(str, "") End If RemoveTrailingNewlinesRegex = str End Function '改行文字の除く Public Function RemoveTrailingNewlines(str As String) As String str = Replace(str, vbCrLf, "") str = Replace(str, Chr(13), "") str = Replace(str, Chr(10), "") RemoveTrailingNewlines = str End Function 'フィアル配列の取得 Public Function OpenWorkBooks() As Variant Dim xlsTmps As Variant xlsTmps = Application.GetOpenFilename("Excelファイル(*.csv;*.xls;*.xlsx),*.xlsx", , "タイトル", , True) If xlsTmps = True And Not xlsTmps Is Nothing Then OpenWorkBooks = xlsTmps Else OpenWorkBooks = Nothing Exit Function End If End Function '指定ブックのオーペン Public Function OpenWorkBook(obj As Object) As Workbook Dim xlsTmp As Workbook If IsObject(obj) Then Set xlsTmp = Application.Workbooks.Open(obj) Else Set xlsTmp = Nothing End If OpenWorkBook = xlsTmp Exit Function End Function
End
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· DeepSeek在M芯片Mac上本地化部署