2007年 11月 26日 ( 1 )

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)