Set a worksheet when looping thru worksheets
Posted on 2014-03-16
I think I am still struggling with SET and explicit references. I have the below lines and I always gate a value for A3, but never for A4. It says A4 is null even though there is a value in A4.
If I explicitly set a reference to "A4" then I have no issue and I get a value for A4. However, I will never know my worksheet name so I can not explicitly set the worksheet name..How do I ensure I get a value for A4.
Dim ws1 as worksheet
For Each ws1 in ThisWorkbook.Worksheets
If ws1.Range ("a3"). value Like "Orange" Then
strValue = ws1.Range ("a3"). value
If ws1.Range ("a4"). value Like "Volunteer Center A" Then
strValue1 = ws1.Range ("a4"). value