#1   Report Post  
Posted to microsoft.public.excel.misc
Jonathan Cooper
 
Posts: n/a
Default simple vba question

example
Sub test2()
'counts number of comments

Dim cmnts As Long
cmnts = ActiveSheet.Comments.Count
MsgBox cmnts
End Sub

When I type

activesheet.
(Notice the period at the end)

Why doesn't VBA then automatically show me the properties/methods of
Activesheet?


  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default simple vba question

Because the activesheet could be a worksheet a chart sheet, etc., so it
cannot know what to present, so it gives nothing.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Jonathan Cooper" wrote in
message ...
example
Sub test2()
'counts number of comments

Dim cmnts As Long
cmnts = ActiveSheet.Comments.Count
MsgBox cmnts
End Sub

When I type

activesheet.
(Notice the period at the end)

Why doesn't VBA then automatically show me the properties/methods of
Activesheet?




  #3   Report Post  
Posted to microsoft.public.excel.misc
Jonathan Cooper
 
Posts: n/a
Default simple vba question

Makes sense. When I started to type that, and nothing happened, I thougth
that there was something wrong with what I was trying to do.

thanks.

"Bob Phillips" wrote:

Because the activesheet could be a worksheet a chart sheet, etc., so it
cannot know what to present, so it gives nothing.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Jonathan Cooper" wrote in
message ...
example
Sub test2()
'counts number of comments

Dim cmnts As Long
cmnts = ActiveSheet.Comments.Count
MsgBox cmnts
End Sub

When I type

activesheet.
(Notice the period at the end)

Why doesn't VBA then automatically show me the properties/methods of
Activesheet?





  #4   Report Post  
Posted to microsoft.public.excel.misc
Duke Carey
 
Posts: n/a
Default simple vba question

Bob's answer is correct. To get the prompts you want use a variable that has
been DIMmed as a Worksheet, i.e.

DIM ws As Worksheet

then when you type "ws." you'll get the prompts you seek

Duke

"Jonathan Cooper" wrote:

example
Sub test2()
'counts number of comments

Dim cmnts As Long
cmnts = ActiveSheet.Comments.Count
MsgBox cmnts
End Sub

When I type

activesheet.
(Notice the period at the end)

Why doesn't VBA then automatically show me the properties/methods of
Activesheet?


  #5   Report Post  
Posted to microsoft.public.excel.misc
Duke Carey
 
Posts: n/a
Default simple vba question

Oops, left out one part

DIM ws as Worksheet
Set ws = Activesheet



"Jonathan Cooper" wrote:

example
Sub test2()
'counts number of comments

Dim cmnts As Long
cmnts = ActiveSheet.Comments.Count
MsgBox cmnts
End Sub

When I type

activesheet.
(Notice the period at the end)

Why doesn't VBA then automatically show me the properties/methods of
Activesheet?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel charts, simple question PH NEWS Excel Worksheet Functions 6 February 9th 06 01:05 PM
Simple average question Newguy123 New Users to Excel 2 February 2nd 06 11:17 PM
a very simple question [email protected] Excel Discussion (Misc queries) 6 November 6th 05 03:50 PM
simple Wildcard Question nastech Excel Discussion (Misc queries) 3 October 17th 05 04:56 AM
Simple Question cjjoo Excel Worksheet Functions 2 October 12th 05 05:38 AM


All times are GMT +1. The time now is 12:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"