Skip to content

Instantly share code, notes, and snippets.

View KotorinChunChun's full-sized avatar

KotorinChunChun KotorinChunChun

View GitHub Profile
@KotorinChunChun
KotorinChunChun / Sheet.vba
Last active January 5, 2020 13:31
20200105_Excelの日付入力時に年末年始の時期だけ年数を書き換えるイベントマクロ
Option Explicit
'Excelの日付入力時に年末年始の時期だけ年数を書き換えるイベントマクロ
'基本方針
' 1. Excelではセルにmm/dd形式で入力した時に今年が自動補完されるが、
' 今月が1月で入力が12月の場合、前年に戻す
' 今月が12月で入力が1月の場合、来年に進む
' という自動補完に変更する。
'
@KotorinChunChun
KotorinChunChun / FuncExcel_Partial.bas
Created February 28, 2020 15:01
特定のエクセルウィンドウだけを並べて表示する関数
'特定のエクセルウィンドウだけを並べて表示する
'https://twitter.com/KotorinChunChun/status/1228606400768593920?s=20
Sub ExcelWindowArrange(targets, arrange_style As XlOrientation)
Const PROC_NAME = "ExcelWindowArrange"
Dim win As Window
Dim obj As Variant
'targetsを解析:整列対象のWindowコレクションを準備
Dim arrangeWindows As Collection: Set arrangeWindows = New Collection
@KotorinChunChun
KotorinChunChun / AppMain.bas
Last active February 28, 2020 15:02
WorkGroupBlocker - 作業グループ禁止アドイン
Rem
Rem 作業グループ禁止アドイン メインモジュール
Rem
Rem 2020/02/18 : 初回版
Rem 2020/02/27 : Gist公開用調整
Rem
Rem @KotorinChunChun
Rem
Option Explicit
Option Private Module
@KotorinChunChun
KotorinChunChun / DevUtilities.vba
Last active February 28, 2020 15:02
プロシージャ自身の名前を示すPROC_NAME定数を更新する
Option Explicit
'vbeProcedureオブジェクトを作成してそれらのコレクションを返す
'モジュール中のコードを解析し、モジュール内のプロシージャ情報をリストアップする
Private Function getProcedures(codeMod As CodeModule) As Collection
Dim StartLine As Long
Dim ProcName As String
Dim lastProcName As String
Dim lastProcKind As vbext_ProcKind
Dim procs As New Collection
@KotorinChunChun
KotorinChunChun / RegApp.cls
Last active April 18, 2020 08:04
VBAのレジストリ操作の拡張クラス
'RegApp 1.レジストリアプリケーション管理
'HKEY_CURRENT_USER\Software\VB and VBA Program Settings\[AppName]
Option Explicit
Public AppName As String
Public Function section(Section_ As String) As RegSec
Set section = New RegSec
Set section.App = Me
section.section = Section_
@KotorinChunChun
KotorinChunChun / FuncString_partial.bas
Created May 4, 2020 09:04
全ての文字に濁点を挿入する関数
Rem --------------------------------------------------
Rem ■kccFuncString
Rem 文字列変換関数 からの抜粋
Rem
Rem
Rem --------------------------------------------------
Option Explicit
Rem 文字列を一文字毎の配列に変換
Rem
@KotorinChunChun
KotorinChunChun / vbaquiz_20200517_AAA2ZZZ.bas
Last active May 19, 2020 15:32
VBAクイズ AAAをZZZまでインクリメントする
Option Explicit
'#VBAクイズ
'出典:http://www.excel.studio-kazu.jp/kw/20200517225250.html
'> AAAの値をAAB,AAC...AAZまでインクリメントし
'> 次のアルファベットを桁上げし、ABA,ABC?ZZZまで
'> 計算するコードを書きたい
'の解答
'https://twitter.com/KotorinChunChun/status/1262026213352026112?s=20
@KotorinChunChun
KotorinChunChun / kccFuncExcelPartial.bas
Created June 24, 2020 14:35
20200624_確実にWorksheetのAutoFilterオブジェクトを返す関数
Rem --------------------------------------------------------------------------------
Rem
Rem @module kccFuncExcelPartial
Rem
Rem @description Excelオブジェクト操作関数
Rem
Rem @update 2020/06/24
Rem
Rem @author @KotorinChunChun (GitHub / Twitter)
Rem
@KotorinChunChun
KotorinChunChun / Test.bas
Last active July 25, 2020 20:55
20200725_配列の次元数に関係なく読み書きする関数
Option Explicit
Rem 動的に多次元配列のテストデータを生成するテスト
Sub Test_CreateTestArray()
Dim tStart As Single, tStop As Single: tStart = Timer
Dim i
For i = 1 To 1000
Dim arr
arr = CreateTestArray(1, 5, 4, 3, 4, 5)
@KotorinChunChun
KotorinChunChun / MyClass.cls.vba
Created August 6, 2020 19:18
20200806_VBAのクラスでNewと同時に引数付きコンストラクタを起動する代替案
Option Explicit
Private name_
Private age_
Rem 標準モジュール用
Public Function Init1(pName, pAge) As MyClass
Set Init1 = Me
name_ = pName
age_ = pAge