View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Alex@JPCS Alex@JPCS is offline
external usenet poster
 
Posts: 33
Default For Each Sheet in Workbook

Lloyd,

Try:

For each sh in Thisworkbook.Sheets
msgbox sh.Range("A1").value
Next sh


No need to Dim the Worksheet.
By the way, its not Sh=Worksheet.


To set a variable equal to a worksheet value I would use:

Dim sh as Worksheet
Set sh=Worksheets("DataValues")
msgbox sh.range("A1").value

HTH,
Alex@JPCS



"Lloyd" <jghflkd!!@dghrtyd_tt wrote in message
...
I need to check the same range.value in each sheet in my workbook.
Dim Sh As Object
Sh=Worksheet
For Each Sh in Workbook
But VBA asks for an Object, apparently not explicit enough. What code do
I need to check the same range.value on each worksheet??
TY
Lloyd


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!