Thread: With statement
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ChadF ChadF is offline
external usenet poster
 
Posts: 44
Default With statement

Is it possible to have nested With statements ??

Problem I have - VBA application that refers back and forth between
workbook / worksheets. I have an 'exterior' With statement like this...

With Workbooks(ThisworkBook).Sheets(MySheet.Name)
' (some code)

Workbooks(AnotherWorkbook).Sheets(3).Activate
With Workbooks(AnotherWorkbook).Sheets(3)

' interior code here will make references to inner With
.Range("someRange").Value = ...

End With
End With

I want to refer to a range defined in the outer With ...is that possible
(and how ?)

Appreciate any advice.

Thanks,
Chad