Skip to content

Instantly share code, notes, and snippets.

風柳 (furyu) furyutei

Block or report user

Report or block furyutei

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@furyutei
furyutei / AreaCollection.vba
Last active Oct 13, 2019
ExcelのRange.Areasに多数のセル領域をセット
View AreaCollection.vba
Option Explicit
Private Const NameLengthLimit = 260 ' Name.RefersTo に設定可能な長さ
Private NamePrefix As String
Private NameNumber As Long
Private TargetWorkbook As Workbook
Private ClearNamesAuto As Boolean
Private AddSheetPrefix As Boolean
Private IsRowAbsolute As Boolean
@furyutei
furyutei / Benchmark.vba
Created Feb 7, 2019
Excel VBAで関数名を文字列で指定してコールする場合のパフォーマンス調査
View Benchmark.vba
Option Explicit
' 参考:[VBAでコールバック関数を使ういろんな方法 - Qiita](https://qiita.com/Kamo123/items/e676e0cbe6de83410980)
Function Func(x As Long) As Double
Func = Rnd * x
End Function
Function Wrapper(x As Long) As Double
Wrapper = WrapperFunc(x)
@furyutei
furyutei / CreateDictionary.vba
Created Jan 30, 2019
Excel VBA:指定された初期値が設定された Dictionary を作成して返す関数/Dictionary の値をまとめて更新する関数
View CreateDictionary.vba
Option Explicit
Function CreateDictionary(ParamArray ParamList() As Variant) As Object
' 指定された初期値が設定された Dictionary を作成して返す
'
' ■引数
' ParamList
' 以下のいずれかを指定
' - key1, value1, key2, value2, ... のようなキーと値の羅列
' - Array(key1, value1, key2, value2, ... )のような配列
@furyutei
furyutei / GetLineBreakText.vba
Last active Jan 20, 2019
Excelで「折り返して全体を表示」状態のセルの文字列を表示されたまま改行が入った状態で取得する試み(挫折)
View GetLineBreakText.vba
Option Explicit
' 元ネタ: [VBA Win32APIを使って、文字列の実描画幅を取得する。 - t-hom’s diary](https://thom.hateblo.jp/entry/2019/01/19/020840)
Function GetLineBreakText(ByRef TargetCell As Range, Optional TemporarySheet As Worksheet) As String
Dim SavedScreenUpdate As Boolean: SavedScreenUpdate = Application.ScreenUpdating
Dim SavedDisplayAlerts As Boolean: SavedDisplayAlerts = Application.DisplayAlerts
Dim SheetIsCreated As Boolean: SheetIsCreated = IIf(TemporarySheet Is Nothing, True, False)
Dim TextMatrix As Variant
Dim TextList() As String
@furyutei
furyutei / Sheet.vba
Last active Jan 11, 2019
Excelで特定行の削除/Undoを検知する試み
View Sheet.vba
Option Explicit
Private Const ConfigSheetName = "config"
Private WatchCellConfig As Range
Private WatchCellDeleted As Boolean
Private Enum ChangeKind
Normal = 0
Deleted = 1
Undo = 2
@furyutei
furyutei / clsProtectLineInsert.vba
Last active Jan 11, 2019
Excelで特定行の挿入や削除を抑制する試み
View clsProtectLineInsert.vba
Option Explicit
' ■ 行挿入/削除監視用クラス
' ◆ 定数・変数定義 {
Private Const MarkString = "mark" ' 挿入禁止行の直上のセルに入れる文字列
Private Const LockString = "lock" ' 挿入禁止行のセルに入れる文字列
@furyutei
furyutei / FolderOperation.vb
Last active Jan 11, 2019
VBAでフォルダ下のファイルリストを高速に取得する試み
View FolderOperation.vb
Imports System.Collections.Concurrent
Imports System.IO
' クラスをCOM経由でアクセス可能にする
<ComClass(FolderOperation.ClassId, FolderOperation.InterfaceId, FolderOperation.EventsId)>
Public Class FolderOperation
' COM用のGUID値
Public Const ClassId As String = "55671817-7D3B-43A8-AFD9-67419DE34442"
Public Const InterfaceId As String = "ADD57B31-105F-414D-9231-3B9FF98388F5"
@furyutei
furyutei / GeneratePassword.vba
Last active Jan 8, 2019
パスワードジェネレータを作る
View GeneratePassword.vba
Option Explicit
Sub GeneratePassword()
'【1】生成するパスワードの桁数を設定
Dim passwordLength As Long
passwordLength = Application.InputBox("何桁のパスワードを生成しますか?(※8桁以上必要です)", Default:=8, Type:=1)
' ※ Application.InputBox の Type に 1 を指定することにより、数値に限定
' https://msdn.microsoft.com/en-us/vba/excel-vba/articles/application-inputbox-method-excel
@furyutei
furyutei / 001-sudoku-history.vba
Last active Jan 8, 2019
数独をExcelのVBAで解くのをやってみた
View 001-sudoku-history.vba
' [数独をExcelのVBAで解くのをやってみた](https://gist.github.com/furyutei/192911043d16f4793c7f21655482aca1)
Option Explicit
Private Const ScreenUpdate As Boolean = False ' True: 画面更新
Private TryCounter As Long ' 試行回数
' 行列←→グループ座標変換用
Private GroupMapInitialized As Boolean
@furyutei
furyutei / CORS_TEST.user.js
Last active Apr 17, 2018
Userscriptで"Access-Control-Allow-Origin"ヘッダが返らないリソースへのアクセスを試行
View CORS_TEST.user.js
// ==UserScript==
// @name CORS_TEST
// @namespace https://furyu.hatenablog.com/
// @version 0.1
// @description CORS TEST (Please access "https://nazo.furyutei.work/test/CORS/" and check the console log)
// @author furyu
// @match https://nazo.furyutei.work/test/CORS/*
// @grant GM_xmlhttpRequest
// @grant GM.xmlHttpRequest
// @connect furyu-tei.sakura.ne.jp
You can’t perform that action at this time.