Google
 
Web itpro-blogger.blogspot.com
日曜日, 10月 07, 2007

[VBA]R1C1形式とA1形式

▼質問
R1C1形式をを英文字のA1形式に変換するにはどうしたらいいの?

▼回答
アクティブセルのR1C1形式・A1形式を取得するサンプルを教えておくよ。
Dim strRowCol As String
Dim strTXlA1 As String
Dim strTXlR1C1 As String
Dim strFXlA1 As String
Dim strFXlR1C1 As String

'1:1
strRowCol = Excel.ActiveCell.Row & ":" & Excel.ActiveCell.Column
'$A$1
strTXlA1 = Excel.ActiveCell.Address(True, True, Excel.XlReferenceStyle.xlA1)
'R1C1
strTXlR1C1 = Excel.ActiveCell.Address(True, True, Excel.XlReferenceStyle.xlR1C1)
'A1
strFXlA1 = Excel.ActiveCell.Address(False, False, Excel.XlReferenceStyle.xlA1)
'R[1]C[1]
strFXlR1C1 = Excel.ActiveCell.Address(False, False, Excel.XlReferenceStyle.xlR1C1)
'A$1
Debug.Print Excel.ActiveCell.Address(True, False, Excel.XlReferenceStyle.xlA1)
'R1C[1]
Debug.Print Excel.ActiveCell.Address(True, False, Excel.XlReferenceStyle.xlR1C1)
'$A1
Debug.Print Excel.ActiveCell.Address(False, True, Excel.XlReferenceStyle.xlA1)
'R[1]C1
Debug.Print Excel.ActiveCell.Address(False, True, Excel.XlReferenceStyle.xlR1C1)






Comments: コメントを投稿

<< Home

This page is powered by Blogger. Isn't yours?