Tuesday, June 26, 2018

Excel VBA: Insert or duplicate column to the left or right of selected cell

Public Sub InsertColumnToTheLeft()
    ActiveCell.EntireColumn.Insert
End Sub

Public Sub InsertColumnToTheRight()
    ActiveCell.Offset(, 1).EntireColumn.Insert
End Sub

Public Sub DuplicateColumnToTheLeft()
    ActiveColumn = ActiveCell.column
    InsertColumnToTheLeft
    CopyColumn ActiveColumn + 1, ActiveColumn
End Sub

Public Sub DuplicateColumnToTheRight()
    ActiveColumn = ActiveCell.column
    InsertColumnToTheRight
    CopyColumn ActiveColumn, ActiveColumn + 1
End Sub

Public Sub CopyColumn(SourceColumn, TargetColumn)
    FinalRow = Cells(Rows.Count, SourceColumn).End(xlUp).Row
    
    For Row = 1 To FinalRow
        Cells(Row, TargetColumn).Value = Cells(Row, SourceColumn).Value
    Next
End Sub

Monday, June 25, 2018

Downgrade or upgrade Node.js and npm on Windows


D:\>node -v
8.9.4

D:\>nvm list

  * 8.9.4 (Currently using 64-bit executable)

D:\>nvm install 6.2.2
Downloading node.js version 6.2.2 (64-bit)...
Complete
Creating C:\Users\balag\AppData\Roaming\nvm\temp

Downloading npm version 3.9.5... Complete
Installing npm v3.9.5...

Installation complete. If you want to use this version, type

nvm use 6.2.2

D:\>nvm list

  * 8.9.4 (Currently using 64-bit executable)
    6.2.2

D:\>nvm use 6.2.2
Now using node v6.2.2 (64-bit)

D:\>nvm list

    8.9.4
  * 6.2.2 (Currently using 64-bit executable)

D:\>node -v
v6.2.2

Thursday, March 8, 2018

Lightroom plugin template

Tuesday, February 20, 2018

[HowTo] Detect USB device attach/detach on MacOS in C#

var fileSystemWatcher = new FileSystemWatcher("/dev");
fileSystemWatcher.Created += (s, e) => { // handle USB device arrival };
fileSystemWatcher.Deleted += (s, e) => { // handle USB device removal };
fileSystemWatcher.EnableRaisingEvents = true;

Environment.SetEnvironmentVariable("MONO_MANAGED_WATCHER", "enabled");


Wednesday, February 7, 2018

[HowTo] Export and import Capture One keyboard shortcut set