Skip to content

Instantly share code, notes, and snippets.

View KotorinChunChun's full-sized avatar

KotorinChunChun KotorinChunChun

View GitHub Profile
@KotorinChunChun
KotorinChunChun / SheetsCopy.vba
Last active August 23, 2020 14:52
戻り値のある複数シートをコピーする関数
Rem --------------------------------------------------
Rem ■戻り値のある複数シートをコピーする関数
Rem
Rem えくせるちゅんちゅん
Rem 2019/10/26
Rem https://www.excel-chunchun.com/entry/vba-sheet-copy
Rem
Rem SheetsCopy
Rem 戻り値のある複数シートをコピーする関数
Rem
@KotorinChunChun
KotorinChunChun / outlook_path_hyperlink_unc.vba
Last active August 23, 2020 14:52
Outlookでメール受信者がローカルパスをクリックできるようにするマクロ2
@KotorinChunChun
KotorinChunChun / outlook_path_hyperlink.vba
Last active August 23, 2020 14:52
20191021_Outlookでメール受信者がローカルパスをクリックできるようにするマクロ
@KotorinChunChun
KotorinChunChun / 01_Win32API_DeclareTo64bit.vba
Created October 21, 2019 11:26
Win32APIのDeclare文を自動的に64bit対応コードに変換するユーザーフォーム
Rem VBA Declare宣言 64bit対応変換ツール
Rem
Rem 新規で作成したユーザーフォームのコードに貼り付けで使用する
Rem
Option Explicit
Private Const GWL_STYLE = (-16)
Private Const WS_THICKFRAME = &H40000
@KotorinChunChun
KotorinChunChun / 01_Win32API_DeclareConverter.vba
Created October 21, 2019 11:20
Win32APIのDeclare文を自動的に64bit対応コードに変換するプログラム
Rem Win32APIのDeclare文を自動的に64bit対応コードに変換するプログラム
Rem
Rem ■公開先
Rem
Rem えくせるちゅんちゅん
Rem 2019/10/20
Rem VBAでWin32APIの64bit対応自動変換プログラムを作ってみた
Rem https://www.excel-chunchun.com/entry/vba-64bit-declare-convert
Rem
Rem ----------------------------------------------------------------------------------------------------
@KotorinChunChun
KotorinChunChun / BinaryFileIO.cls.vba
Created September 8, 2020 15:34
バイナリファイル読み書きラッパークラス
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "BinaryFileIO"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Rem --------------------------------------------------------------------------------
@KotorinChunChun
KotorinChunChun / vba_knock013.bas.vba
Created November 1, 2020 07:58
VBA100本ノック13本目
Option Explicit
'#VBA100本ノック 13本目
'選択セル(Selection:複数範囲あり)の文字列に「注意」という文字があった場合は、
'その「注意」の文字だけを"赤の太字"に設定してください。
'セル以外(図形等)が選択されている場合は何もせずに正常終了するようにしてください。
'※一部仕様を無視
' 図形選択前に選択していたセルを使ってでも絶対に処理を実行する
Sub vba_knock013()
@KotorinChunChun
KotorinChunChun / vba_knock014.bas.vba
Created November 2, 2020 12:31
VBA100本ノック14本目
Option Explicit
'VBA100本ノック14本目
'出題を勘違いして答えた人の末路
Sub vba_knock14()
Dim wb As Workbook: Set wb = ActiveWorkbook
Dim ws As Worksheet
Dim moveWss As Variant: ReDim moveWss(0 To 0) '0はダミー
'削除すべきシートを特定
@KotorinChunChun
KotorinChunChun / kncok.vba
Last active December 7, 2020 16:13
VBA100本ノック41本目
Option Explicit
Sub knock41()
Dim res As Dictionary: Set res = Quiz四則演算いっぱい出題(99, 20, 3)
Dim msg As Dictionary: Set msg = New Dictionary
Dim key, 正解数
For Each key In res.Keys
正解数 = 正解数 + IIf(res.Item(key), 1, 0)
msg.Add Join(Array( _
IIf(res.Item(key), "○", "×"), _
@KotorinChunChun
KotorinChunChun / kccExtScience.bas.vba
Created October 31, 2020 05:13
選択中のセルの化学式の書式を整えるVBAマクロ
Rem 選択中のセルの化学式の書式を整えるVBAマクロ
Sub 選択範囲の化学式の書式を整える()
Dim MyRange As Range
Dim i As Integer
Dim s2 As String, s3 As String
Dim PHflg As Boolean
For Each MyRange In Selection
For i = 2 To Len(MyRange.Text)
s2 = Mid(MyRange.Text, i - 1, 2)