View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tushar Mehta Tushar Mehta is offline
external usenet poster
 
Posts: 1,071
Default Problems Defining Object Variable in For Each Loop

Inside the loop whereever you want to refer to the comments (or
usedrange) for the sheet associated with the loop, use sh.Comments (or
sh.UsedRange). Now, you can safely throw away ObjCollArray.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I think my problem is that my array says:

Private Sub OKButton_Click()
Set ObjCollArray(0) = ActiveSheet.Comments
Set ObjCollArray(1) = ActiveSheet.UsedRange
Set ObjCollArray(2) = ActiveSheet.UsedRange
Set ObjCollArray(3) = ActiveSheet.UsedRange
Set ObjCollArray(4) = ActiveSheet.UsedRange
Set ObjCollArray(5) = ActiveSheet.UsedRange

I then reference these within a For Each sheet Loop which
loops through specific sheets. I am not sure how to set
this up differently do that it works.



{snip}