byronwall / bUTL

Excel add-in with helpers for charting, formatting, and general pain points
http://byroni.us/bUTL
MIT License
16 stars 3 forks source link

Split columns based on Selection #9

Closed byronwall closed 9 years ago

byronwall commented 9 years ago

This is a feature which needs to be able to take an input range like the other ones.

RaymondWise commented 9 years ago

I did this one as well - where did the export modules go?

Sub SplitIntoColumns()

    Dim rngInput As Range

    Set rngInput = Application.InputBox("Select the range of cells to split:", Type:=8)

    Dim c As Range

    Dim strDelim As String
    strDelim = Application.InputBox("What is the delimeter?", , ",", vbOKCancel)
    If strDelim = "" Then GoTo errHandler
    If strDelim = "False" Then GoTo errHandler
    For Each c In rngInput

        Dim arrParts As Variant
        arrParts = Split(c, strDelim)

        Dim varPart As Variant
        For Each varPart In arrParts

            Set c = c.Offset(, 1)
            c = varPart

        Next varPart

    Next c
    Exit Sub
errHandler:
    MsgBox ("No Delimiter Defined!")
End Sub
byronwall commented 9 years ago

I moved it all into a build script outside of the actual add-in. You should be able to run the scripts/create src from xlam which is a batch file that calls a PowerShell script which uses COM to run an export macro in a separate build-manager.xlsm file. That build script also exports the full xlam file to a folder (unzipping it) which allows for changes to the Ribbon to be tracked properly.

Hopefully that process works with your setup. I assumed PowerShell was universally available... hopefully that's right.

RaymondWise commented 9 years ago

Clever. I'm pretty sure it will work. At work (where I do most of this) I snuck myself into the local admin group - so I can run it. My main machine at home is W7 as well. I keep github in dropbox.

byronwall commented 9 years ago

Make sure you run the right script. One of those will delete your current xlam and replace it with the information stored in /src/. The other will rebuild /src/ from your working xlam copy which then allows it to be committed with all of the changes apparent in full text (VBA in /code/ and Ribbon stuff in /package/customUI/).

At some point I would like to remove the bUTL.xlam binary from the repo to ensure that there can't be a mismatch between /src/ and the binary. The xlam file would move over to Releases here on GitHub and then development could take place from essentially plain text files. After updating the repo, you would run the file to create the xlam from source. (The VBA binary is also technically included in /src/package/ but it gets recreated in the build script)

I added the enter "y" to proceed because I ran the wrong script once and erases some local changes.

Hopefully that makes sense.