Curtisyoung78
New Member
- Joined
- Jun 19, 2017
- Messages
- 25
I have this code to compare two sheets that will bold the differences between the sheets, the problem is i only want to compare from column A:Q and from row 12 down to infinity. And not the used range as specified in the code below.
Hope someone can help thanks in advance.
Sub RunCompare()
Call compareSheets("REV0", "REV1")
End Sub
Sub compareSheets(shtREV0 As String, shtREV1 As String)
Dim mycell As Range
Dim mydiffs As Integer
For Each mycell In ActiveWorkbook.Worksheets(shtREV1).UsedRange 'here I need it to look at column A:Q and from row 12 down to infinity
If Not mycell.Value = ActiveWorkbook.Worksheets(shtREV0).Cells(mycell.Row, mycell.Column).Value Then
mycell.Font.Bold = True
mydiffs = mydiffs + 1
End If
Next
ActiveWorkbook.Sheets(shtREV1).Select
End Sub
Hope someone can help thanks in advance.
Sub RunCompare()
Call compareSheets("REV0", "REV1")
End Sub
Sub compareSheets(shtREV0 As String, shtREV1 As String)
Dim mycell As Range
Dim mydiffs As Integer
For Each mycell In ActiveWorkbook.Worksheets(shtREV1).UsedRange 'here I need it to look at column A:Q and from row 12 down to infinity
If Not mycell.Value = ActiveWorkbook.Worksheets(shtREV0).Cells(mycell.Row, mycell.Column).Value Then
mycell.Font.Bold = True
mydiffs = mydiffs + 1
End If
Next
ActiveWorkbook.Sheets(shtREV1).Select
End Sub