View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Check a value in a range

Hi Bill,

In addition to Michael's suggestion, a range object, or, indeed,
any object, must be instantiated usinf the Set statement, e.g.:

change

checkcellA = Worksheets("Inventory Sheet 1 & 2").Cells(counter, 1)


to

set checkcellA = Worksheets("Inventory Sheet 1 & 2").Cells(counter, 1)



---
Regards,
Norman


"Bill" wrote in message
...
I am trying to check a cell to see if it's a C. The example below is a sub
that is called from a Do Loop. The line checkcellA = Worksheets .... is
causing problems. Is it because of the variable counter??



Sub sub1()
Dim checkcellA As Range
checkcellA = Worksheets("Inventory Sheet 1 & 2").Cells(counter, 1)
If checkcellA = "C" Then Call Sub2

End Sub