0% found this document useful (0 votes)
4 views1 page

Excel VBA Fill Routine Script

The document describes a VBA macro that fills cells in a range with the letter S based on matches between values in two different ranges. The macro uses loops to compare each cell in one range to each cell in another range and checks for matches using wildcard patterns, filling the corresponding cell when a match is found.

Uploaded by

yleets
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Excel VBA Fill Routine Script

The document describes a VBA macro that fills cells in a range with the letter S based on matches between values in two different ranges. The macro uses loops to compare each cell in one range to each cell in another range and checks for matches using wildcard patterns, filling the corresponding cell when a match is found.

Uploaded by

yleets
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Sub FillRoutine()

Dim EffectRange As Range


Dim Col As Range
Dim CauseRange As Range
Dim ThisCell1 As Range
Dim ThisCell2 As Range
Dim LRow As Long
Dim LColumn As Long

LRow = Cells([Link], 1).End(xlUp).Row

Set CauseRange = [Link]


[Link] = False

'Range("Q1").Select
'[Link](Selection,
[Link](xlLastCell)).Select
Set EffectRange = Range("Q4:IN4")

For Each ThisCell1 In Range("A6:A1529")


For Each ThisCell2 In Range("A1536:A" & LRow)
If [Link] Like [Link] + "*PVHH*" Or _
[Link] Like [Link] + "*ZSC_HMI*" Or _
[Link] Like [Link] + "*ZSO_HMI*" Or _
[Link] Like [Link] + "*AlarmOut*" Or _
[Link] Like [Link] + "*PVLL*" Then
[Link](0, ([Link]("R006").Column) - 1).Value = "S"
On Error Resume Next
Exit For
End If
Next ThisCell2
Next ThisCell1
On Error Resume Next
[Link] = True
End Sub

You might also like