<   2007年 11月 ( 3 )   > この月の画像一覧

VBA(11/27)


'このExcelでのF12キーを再定義する
Sub auto_おpen()
Application.OnKey "{F12}", "Kbd_Disp"
End Sub

'キーボードを再表示する
Sub Kbd_Disp()
Form_Base.Show vbModeless
'Form_Base.OBtn_SleepTime1.Value = True 'ラジオボタンのデフォルトをメンバー1に設定
End Sub
[PR]
by k1segawa | 2007-11-28 00:45 | Comments(0)

VBA(11/26)

Private Sub BtnASTER_Click()
Dim a As String

Form_Base.Show

'現在のセル内容に"_"+セル番号を付加する
a = Range("A4").Value

Range("A4").Value = a + "_" + Replace(Range("A4").Address, "$", "")


'a = Cells(1,1)
End Sub

Private Sub BtnSELECT_Click()
ActiveCell.FormulaR1C1 = "SEL"
ActiveCell.Activate
End Sub

'末尾から_$A$Bを削除
Private Sub CommandButton1_Click()
Dim i As Integer
Dim c As Integer

i = InStrRev(Range("A4"), "_")
If IsNumeric(Right(Range("A4"), 1)) Then
c = Asc(Mid(Range("A4"), i + 1, 1))
If (c >= Asc("A") And c <= Asc("Z")) Or (c >= Asc("a") And c <= Asc("z")) Then
Range("A4").Value = Left(Range("A4"), i - 1)
End If
End If
End Sub
[PR]
by k1segawa | 2007-11-26 07:37 | Comments(0)

VBA(11/22)

' 複数の置換範囲を文字列で格納
Dim RangeArray(1 To 64) As String

' 置換範囲に行を設定
Sub DefineRangeColum()
RangeArray(1) = "A:F"
End Sub

' 置換範囲に列を付加
Sub SetRangeColum()
Range(Replace(RangeArray(1), ":", "4:") + "4").Select
End Sub

' マクロを数値に置換
Sub ReplaceMtoV()

DefineRangeColum
SetRangeColum

With Selection
.Replace What:="*", Replacement:="11"
End With
End Sub

' 数値をマクロに置換
Sub ReplaceVtoM()

DefineRangeColum
SetRangeColum

With Selection
.Replace What:="11", Replacement:="*"
End With
End Sub

Private Sub BtnASTER_Click()

End Sub

Private Sub BtnSELECT_Click()
ActiveCell.FormulaR1C1 = "SEL"
ActiveCell.Activate
End Sub

VBA Active セル
http://office.microsoft.com/ja-jp/help/HA010429521041.aspx?pid=CH010714411041
[PR]
by k1segawa | 2007-11-22 00:35 | Comments(3)