title: Object Required Error in excel VBA
body: <pre><code>Dim g1val, g2val As Integer
  
  Set g1val = 0
  Set g2val = 0
  
  For i = 3 To 18
      If g1val &gt; Cells(33, i).Value Then
          g1val = g1val
      Else
          g1val = Cells(33, i).Value
      End If
  Next i
  
  For j = 32 To 57
      If g2val &gt; Cells(31, j).Value Then
          g2val = g2val
      Else
          g2val = Cells(31, j).Value
      End If
  Next j
  </code></pre>
  
  <p>Here on second line i am getting an error saying object required.I have tried to make g1val and g2val as "Double" and tried to give 1 for their values at first.But those didn't work out. Can u help??....</p>