I've never looked for it.
But you can see it yourself.
Change your code (temporarily) to:
Private Sub CommandButton1_Click()
Worksheets(1).Activate
msgbox Cells(1, 1).parent.name
End Sub
(make sure that the worksheet with the button is not worksheets(1), though.)
pt wrote:
>
> Oh,I see, it is reasonable, many thanks ,Dave. And I had search the help of
> EXCEL VBA
> reference, but did't find it, all the explaination I found is that the
> unqualified range belongs to
> the activesheet. May you tell me Where can I find it?Many Thanks.
>
> PanTao
>
> --------------------------------------
> "Dave Peterson" <(E-Mail Removed)>
> ??????:(E-Mail Removed)...
> > If the code is in a general module, then the unqualified range belongs to
> > the
> > activesheet.
> >
> > If the code is behind a worksheet (and it is in your case), then the
> > unqualified
> > ranges belong to the object owning the code -- the sheet with the
> > commandbutton.
> >
> > Private Sub CommandButton1_Click()
> > Worksheets(1).Activate 'you don't even need this line!
> > worksheets(1).Cells(1, 1).Value = "kk"
> > End Sub
> >
> >
> >
> > pt wrote:
> >>
> >> hi,all:
> >> I face a problem, I have a button control in worksheet 2,
> >> and the code as below:
> >>
> >> Private Sub CommandButton1_Click()
> >> Worksheets(1).Activate
> >> Cells(1, 1).Value = "kk"
> >> End Sub
> >>
> >> and It seems that worksheet 1 is activated ,but kk is
> >> set at the worksheet 2's cell (1,1) not at the worksheet 1.
> >> It seems that the defaultworksheet is not the active worksheet.
> >> It is so strange. Why it is so?
> >>
> >> many thanks,
> >> PanTao
> >
> > --
> >
> > Dave Peterson
--
Dave Peterson
|