Hi
I could be wrong here but you shouldn't need to apply usedrange to the
active sheet
eg
Dim ws As Worksheet
Set ws = Worksheets("sheet1")
With ws
MsgBox .UsedRange.Address
End With
Set ws = Nothing
should work from anywhere within the workbook
;-)
Kobayashi wrote in message
...
Can the UsedRange method only be used when preceded by 'Activesheet'? I
have a variable for a worksheet which I am trying to use in a 'With'
statement:
With [Variable name]
UsedRange
and so on.....
but I cannot get this to work unless I replace the place a Select
statement before the 'With' statement and then replace the variable
name with 'Activesheet'?
Now, I am still a relative novice at this Excel VBA stuff but what I
have read in my pursuit of knowledge is that a 'good' programmer will
refrain from using Select/Activate statements in their code wherever
possible? So, I am a both stuck and a little confused???
Therefore, any help in clarifying this would be very much appreciated!
Thanks,
Adrian
---
Message posted from http://www.ExcelForum.com/