Category: ‘Excel’

Excel VBA で別シートの最終行の値を取得する

2011年11月29日 Posted by PURGE

ワークシートの”Sheet2″ の値の存在する最終行のValue を取得する方法。
一度、シートの最終行を取得し、xlUpで戻るイメージ。

Sub getLastRowValue()
    Dim val As String

    val = Worksheets("Sheet2").Range("E" & Rows.Count).End(xlUp).Value

    MsgBox val

End Sub

Excel VBA 選択範囲のセルの数取得

2011年11月28日 Posted by PURGE

    Range("A2").Select
    Range(Selection, Selection.End(xlDown)).Select
    rowcnt = Selection.Rows.Count

Excel VBA テンプレートエンジン

2011年10月5日 Posted by PURGE

エクセルのテンプレートエンジンを試してみる。MiniTemplator

使用した感想は後日。たぶん・・・。

Excel VBAファイル出力

2011年9月27日 Posted by PURGE

Option Explicit

Sub CreateFile()

Dim StrFileName As String
Dim intFileNo As Integer

StrFileName = ActiveWorkbook.Path & "out.txt"
intFileNo = FreeFile



Open StrFileName For Output As #intFileNo

Write #intFileNo, "これはWriteテストです。"
Print #intFileNo, "これはPrintテストです。"

Close #intFileNo

End Sub