Find���\�b�h,Like���Z�q���g��������:Excel VBA���� |
�X�|���T�[�h�����N | |
Find���\�b�h | Like���Z�q | Replace���\�b�h |
���� | �萔 | ���e |
What | �@ | ��������f�[�^���w�� |
After | �@ | �ȗ��F�������J�n����Z�����w��B �w�肵���Z�����̂́A�������͈͑S�̂���x�������Ė߂��Ă���܂Ō�������܂���B �ȗ�����ƍ���[����J�n���܂��B |
LookIn | �ȗ��F���̎�ނ��w��B | |
xlFormulas | ���� | |
xlValues | �l | |
xlComents | �R�����g�� | |
LookAt | �ȗ��� | |
xlPart | �ꕔ����v����Z�������� | |
xlWhole | �S����v����Z�������� | |
SearchOrder | �ȗ��F�����̕������w�� | |
xlByRows | �����������s�ɂ��܂� | |
xlByColumns | �����������ɂ��܂� | |
SearchDirection | �ȗ��F�����̏������w�� | |
xlNext | ������ | |
xlPrevious | �t���� | |
MatchCase | �ȗ��F�啶���Ə���������ʂ���B | |
True | ��ʂ��� | |
False | ��ʂ��Ȃ� | |
MatchByte | �ȗ��F���p�ƑS�p����ʂ��� | |
True | ��ʂ��� | |
False | ��ʂ��Ȃ� | |
SearchFormat | �ȗ��F�����ɏ������܂߂�B | |
True | �܂߂� | |
False | �܂߂Ȃ� |
Sub Find_01() �@Dim c As Object �@Dim myKey As String, fAddress As String �@�@�@myKey = "��������" �@�@�@With Worksheets(1).Range("a1:a30") �@�@�@�@�@ Set c = .Find(What:=myKey, LookIn:=xlValues, lookat:=xlWhole, _ �@�@�@�@�@�@�@�@�@�@�@�@�@�@SearchOrder:=xlByColumns, MatchByte:=False) �@�@�@�@�@If Not c Is Nothing Then �@�@�@�@�@�@�@fAddress = c.Address �@�@�@�@�@�@�@Do �@�@�@�@�@�@�@�@�@c.Interior.ColorIndex = 4 '���邢�� �@�@�@�@�@�@�@�@�@Set c = .FindNex��(c) �@�@�@�@�@�@�@�@�@�@�@If c.Address = fAddress Then Exit Do �@�@�@�@�@�@�@Loop �@�@�@�@�@End If �@�@�@End With End Sub |
Sub Find_02() �@Dim c As Object �@Dim myKey As String, fAddress As String �@�@�@myKey = "��" �@�@�@With Worksheets(1).Range("a1:a30") �@�@�@�@�@ Set c = .Find(What:=myKey, LookIn:=xlValues, lookat:=xlPart, _ �@�@�@�@�@�@�@�@�@�@�@�@�@�@SearchOrder:=xlByColumns, MatchByte:=False) �@�@�@�@�@If Not c Is Nothing Then �@�@�@�@�@�@�@fAddress = c.Address �@�@�@�@�@�@�@Do �@�@�@�@�@�@�@�@�@c.Interior.ColorIndex = 4 '���邢�� �@�@�@�@�@�@�@�@�@Set c = .FindNex��(c) �@�@�@�@�@�@�@�@�@�@�@If c.Address = fAddress Then Exit Do �@�@�@�@�@�@�@Loop �@�@�@�@�@End If �@�@�@End With End Sub |
Sub Find_03() �@Dim c As Object �@Dim r As Range �@Dim myKey As String �@�@For Each r In Range("A2:A4") �@�@�@�@myKey = Left(r.Value, 5) �@�@�@�@Set c = Range("E2:E9").Find(myKey, LookAt:=xlWhole) �@�@�@�@If c Is Nothing Then �@�@�@�@�@�@MsgBox myKey & "�͌�����܂���ł����B" �@�@�@�@Else �@�@�@�@�@�@r.Offset(0, 1).Value = c.Offset(0, 1).Value �@�@�@�@End If �@�@Next r End Sub |
�����p�^�[�� | ����string�̒��̈�v���镶�� |
? | �C�ӂ�1���� |
* | �C�ӂ̐��̕��� |
# | �C�ӂ�1�����̐��� (0-9) |
[charlist] | �������X�g(charlist)�Ɏw�肵�������̒��̔C�ӂ�1���� |
[!charlist] | �������X�g(charlist)�Ɏw�肵�������ȊO�̔C�ӂ�1���� |
Sub Find_01() Dim c As Object �@�@For Each c In Worksheets(1).Range("a1:a30") �@�@�@�@If c.Value Like "��������" Then �@�@�@�@�@�@c.Interior.ColorIndex = 3 '�� �@�@�@�@End If �@�@Next c End Sub |
Sub Like_02() Dim c As Object �@�@For Each c In Worksheets(1).Range("a1:a30") �@�@�@�@If c.Value Like "*��*" Then �@�@�@�@�@�@c.Interior.ColorIndex = 3 '�� �@�@�@�@End If �@�@Next c End Sub |
Sub Like_03() Dim c As Object �@�@For Each c In Worksheets(1).Range("a1:a30") �@�@�@�@If c.Phonetic.Text Like "[��-��]*" Then �@�@�@�@�@�@c.Interior.ColorIndex = 3 '�� �@�@�@�@End If �@�@Next c End Sub |
Sub Find_02() �@Dim c As Object �@�@�@With Worksheets("Sheet1").Range("C1:C30") �@�@�@�@�@.Replace What:="������", Replacement:="��������", _ �@�@�@�@�@�@�@SearchOrder:=xlByColumns, MatchByte:=False �@�@�@�@�@End With End Sub |
�X�|���T�[�h�����N
PageViewCounter
�@
�@Since2006/2/27