C
Corey
Basically i have 2 sheets
Sheet 1 has data in column A(Say called RL-Values) and related values in the
same row in Column L and every 9 Columns across through to Column GJ. (Say
Called LL-Values)
Sheet 2 may have a value from Sheet 1 Column A in Columns K and every 16
Columns across on the same row(K-BW)[5 cells in total]. (Say Called
URL-Values)
But each time there is a value in the column K,AA,AQ,BG or/and BW a value
also is found in the column to the Right(eg. If K=951 then L may be 50) and
so on across through each of the 5 possible cells(K-BW) that may contain a
value from Sheet1.(Say Called ULL-Values)
So recapping:
Sheet2 has values in Columns K,AA,AQ,BG,BW that are found in Column A in
Sheet1.
If a value IS in a Column in Sheet2, then the adjacent Column(L for Column K
value etc) will have a value from Sheet1 Column L,U,AD,AM,AV....[every 9
Columns] until GJ.
I am trying to make a macro to search the RL-Values for a match in the
URL-Values, then find the ralated value in the ULL-Values in the LL-Values,
and have the font changed to Strikethough.
It is easy in my mind, but difficult to explain in words as to the required
outcome.
Previously i used the below code to do this, but i have now modified the way
the data is stored, and it is now stored in a single row instead in about 22
rows.
****************************
Sub RemoveUsedRolls()
Application.ScreenUpdating = False
Dim LastCell As Long
Dim myrow As Long
LastCell = Worksheets("InspectionData").Cells(Rows.Count,
"A").End(xlUp).Row
With ActiveWorkbook.Worksheets("InspectionData")
For myrow = 2 To LastCell
If .Cells(myrow, 1) <> "" And .Cells(myrow, 1).Font.Bold = True
Then
For i = 2 To 22
If .Cells(myrow, 1).Offset(i, 2).Value <> "" And .Cells(myrow,
1).Offset(i, 2).Font.Strikethrough = True _
And .Cells(myrow, 1).Offset(i, 2).Font.Strikethrough <> False
Then
.Cells(myrow, 1).Font.Strikethrough = True
End If
Next i
End If
Next
End With
With ActiveWorkbook.Worksheets("InspectionData")
For myrow = 2 To LastCell
If .Cells(myrow, 1) <> "" And .Cells(myrow, 1).Font.Bold = True
Then
For i = 2 To 22
If .Cells(myrow, 1).Offset(i, 2).Value <> "" And .Cells(myrow,
1).Offset(i, 2).Font.Strikethrough = False Then
.Cells(myrow, 1).Font.Strikethrough = False
End If
Next i
End If
Next
End With
Sheets("Main").Activate
Application.ScreenUpdating = True
End Sub
****************************
Corey...
Sheet 1 has data in column A(Say called RL-Values) and related values in the
same row in Column L and every 9 Columns across through to Column GJ. (Say
Called LL-Values)
Sheet 2 may have a value from Sheet 1 Column A in Columns K and every 16
Columns across on the same row(K-BW)[5 cells in total]. (Say Called
URL-Values)
But each time there is a value in the column K,AA,AQ,BG or/and BW a value
also is found in the column to the Right(eg. If K=951 then L may be 50) and
so on across through each of the 5 possible cells(K-BW) that may contain a
value from Sheet1.(Say Called ULL-Values)
So recapping:
Sheet2 has values in Columns K,AA,AQ,BG,BW that are found in Column A in
Sheet1.
If a value IS in a Column in Sheet2, then the adjacent Column(L for Column K
value etc) will have a value from Sheet1 Column L,U,AD,AM,AV....[every 9
Columns] until GJ.
I am trying to make a macro to search the RL-Values for a match in the
URL-Values, then find the ralated value in the ULL-Values in the LL-Values,
and have the font changed to Strikethough.
It is easy in my mind, but difficult to explain in words as to the required
outcome.
Previously i used the below code to do this, but i have now modified the way
the data is stored, and it is now stored in a single row instead in about 22
rows.
****************************
Sub RemoveUsedRolls()
Application.ScreenUpdating = False
Dim LastCell As Long
Dim myrow As Long
LastCell = Worksheets("InspectionData").Cells(Rows.Count,
"A").End(xlUp).Row
With ActiveWorkbook.Worksheets("InspectionData")
For myrow = 2 To LastCell
If .Cells(myrow, 1) <> "" And .Cells(myrow, 1).Font.Bold = True
Then
For i = 2 To 22
If .Cells(myrow, 1).Offset(i, 2).Value <> "" And .Cells(myrow,
1).Offset(i, 2).Font.Strikethrough = True _
And .Cells(myrow, 1).Offset(i, 2).Font.Strikethrough <> False
Then
.Cells(myrow, 1).Font.Strikethrough = True
End If
Next i
End If
Next
End With
With ActiveWorkbook.Worksheets("InspectionData")
For myrow = 2 To LastCell
If .Cells(myrow, 1) <> "" And .Cells(myrow, 1).Font.Bold = True
Then
For i = 2 To 22
If .Cells(myrow, 1).Offset(i, 2).Value <> "" And .Cells(myrow,
1).Offset(i, 2).Font.Strikethrough = False Then
.Cells(myrow, 1).Font.Strikethrough = False
End If
Next i
End If
Next
End With
Sheets("Main").Activate
Application.ScreenUpdating = True
End Sub
****************************
Corey...