View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Michael Malinsky Michael Malinsky is offline
external usenet poster
 
Posts: 24
Default Check a value in a range

The variable "counter" is the problem because the code will not pass
the value of the variable from one sub to another automatically. You
have to tell it to do that. So when you call sub1 from your main sub
you need to use

sub1(counter)

provided that counter is the variable name in your main sub. You then
need to change sub1 to read:

Sub sub1(counter as Integer)

I believe that should help. If not post back.


On Apr 13, 9:36 am, Bill wrote:
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