Thread: [Solved] For Next Loop cell values
View Single Post
 
Old 02-11-2015, 11:28 PM
excelledsoftware excelledsoftware is offline Windows 7 64bit Office 2003
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

I know this is an older post but I cant help but want to help.

I would write what you are doing slightly different but I know it works this way.

Code:
Sub CompareData()
  'Looks at a range and compares it another
  Dim CheckRow As Integer, ws As Worksheet
  
  Set ws = ThisWorkbook.Worksheets("Sheet1")
  
  For CheckRow = 1 To 10
    If ws.Range("A" & CheckRow).Value = ws.Range("F" & CheckRow).Value Then
      'Do whatever you want to do here.
      'Example 1 ws.range("G" & CheckRow).value = "They Match"
    Else
      'Do whatever you want if they dont match or just remove this to say
      'End if
    End If
  Next CheckRow
  
End Sub
Reply With Quote