PC Review


Reply
Thread Tools Rate Thread

Basic Syntax

 
 
Nick_F
Guest
Posts: n/a
 
      22nd Dec 2006
I have recently begun learning programming in Excel after coming from a
Matlab background. I find myself constantly running into syntax errors
and other 'Bill Gates effects'. For example I use the macro recorder to
produce the following simple proceedure...

Sub selectrange()
Sheets("Data").Select
Range("A24").Select
Range(Selection, Selection.End(xlDown)).Select
End Sub

That seems grossly inefficient and so I thought the following line
would do the trick...

Sub selectrange()
Sheets("Data").("a24", "a24".End(xlDown)).Select
End Sub

but I get a compile error. Can anyone point out my problem,
understanding that may help me to grasp how VBA likes to talk.

Perhaps members in the list might also like to suggest some favourite
sources of general tips on coming to grips with excel syntax or perhaps
good desk references of the VBA programming language.

I have found the newsgroups and knowledge base give good detail on
specific objects, methods etc... but I have yet to find any good
instructions in the various groups and MVP websites on the basics of
when to use various operators like () , : . = For example, connect
objects with periods or enclose strings with quotes.

Cheers
Nick Flyger

 
Reply With Quote
 
 
 
 
Gary Keramidas
Guest
Posts: n/a
 
      22nd Dec 2006
really no need to select most of the time, but here it is

Worksheets("data").Range("A24", Range("A24").End(xlDown)).Select

--


Gary


"Nick_F" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have recently begun learning programming in Excel after coming from a
> Matlab background. I find myself constantly running into syntax errors
> and other 'Bill Gates effects'. For example I use the macro recorder to
> produce the following simple proceedure...
>
> Sub selectrange()
> Sheets("Data").Select
> Range("A24").Select
> Range(Selection, Selection.End(xlDown)).Select
> End Sub
>
> That seems grossly inefficient and so I thought the following line
> would do the trick...
>
> Sub selectrange()
> Sheets("Data").("a24", "a24".End(xlDown)).Select
> End Sub
>
> but I get a compile error. Can anyone point out my problem,
> understanding that may help me to grasp how VBA likes to talk.
>
> Perhaps members in the list might also like to suggest some favourite
> sources of general tips on coming to grips with excel syntax or perhaps
> good desk references of the VBA programming language.
>
> I have found the newsgroups and knowledge base give good detail on
> specific objects, methods etc... but I have yet to find any good
> instructions in the various groups and MVP websites on the basics of
> when to use various operators like () , : . = For example, connect
> objects with periods or enclose strings with quotes.
>
> Cheers
> Nick Flyger
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
please I need help with basic ado.net save, basic syntax needed =?Utf-8?B?TmV3YmVlIEFkYW0=?= Microsoft Dot NET 5 28th Jun 2005 07:09 AM
basic syntax question =?Utf-8?B?YWU=?= Microsoft ADO .NET 1 3rd Nov 2004 05:29 PM
Basic syntax ? David Microsoft Excel Programming 2 10th Mar 2004 08:00 AM
Help: Visual Basic Syntax Al Microsoft Excel Programming 7 3rd Nov 2003 10:53 AM
More Visual Basic Syntax Al Microsoft Excel Programming 2 3rd Nov 2003 07:25 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:23 AM.