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?
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)
quot;Jonathan Cooperquot; gt; wrote in
message ...
gt; example
gt; Sub test2()
gt; 'counts number of comments
gt;
gt; Dim cmnts As Long
gt; cmnts = ActiveSheet.Comments.Count
gt; MsgBox cmnts
gt; End Sub
gt;
gt; When I type
gt;
gt; activesheet.
gt; (Notice the period at the end)
gt;
gt; Why doesn't VBA then automatically show me the properties/methods of
gt; Activesheet?
gt;
gt;
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.
quot;Bob Phillipsquot; wrote:
gt; Because the activesheet could be a worksheet a chart sheet, etc., so it
gt; cannot know what to present, so it gives nothing.
gt;
gt; --
gt; HTH
gt;
gt; Bob Phillips
gt;
gt; (remove nothere from email address if mailing direct)
gt;
gt; quot;Jonathan Cooperquot; gt; wrote in
gt; message ...
gt; gt; example
gt; gt; Sub test2()
gt; gt; 'counts number of comments
gt; gt;
gt; gt; Dim cmnts As Long
gt; gt; cmnts = ActiveSheet.Comments.Count
gt; gt; MsgBox cmnts
gt; gt; End Sub
gt; gt;
gt; gt; When I type
gt; gt;
gt; gt; activesheet.
gt; gt; (Notice the period at the end)
gt; gt;
gt; gt; Why doesn't VBA then automatically show me the properties/methods of
gt; gt; Activesheet?
gt; gt;
gt; gt;
gt;
gt;
gt;
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 quot;ws.quot; you'll get the prompts you seek
Duke
quot;Jonathan Cooperquot; wrote:
gt; example
gt; Sub test2()
gt; 'counts number of comments
gt;
gt; Dim cmnts As Long
gt; cmnts = ActiveSheet.Comments.Count
gt; MsgBox cmnts
gt; End Sub
gt;
gt; When I type
gt;
gt; activesheet.
gt; (Notice the period at the end)
gt;
gt; Why doesn't VBA then automatically show me the properties/methods of
gt; Activesheet?
gt;
gt;
Oops, left out one part
DIM ws as Worksheet
Set ws = Activesheet
quot;Jonathan Cooperquot; wrote:
gt; example
gt; Sub test2()
gt; 'counts number of comments
gt;
gt; Dim cmnts As Long
gt; cmnts = ActiveSheet.Comments.Count
gt; MsgBox cmnts
gt; End Sub
gt;
gt; When I type
gt;
gt; activesheet.
gt; (Notice the period at the end)
gt;
gt; Why doesn't VBA then automatically show me the properties/methods of
gt; Activesheet?
gt;
gt;
- Jan 24 Wed 2007 20:35
simple vba question
close
全站熱搜
留言列表
發表留言