Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Basic Syntax

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Basic Syntax

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" wrote in message
ups.com...
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
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
right syntax pls123 Excel Worksheet Functions 8 May 6th 10 05:18 AM
Basic question....syntax on active cells from a filter Rominall Excel Programming 3 February 16th 06 10:14 PM
Can I run Visual Basic procedure using Excel Visual Basic editor? john.jacobs71[_2_] Excel Programming 3 December 26th 05 02:22 PM
Help: Visual Basic Syntax Al[_12_] Excel Programming 7 November 3rd 03 10:53 AM
More Visual Basic Syntax Al[_12_] Excel Programming 2 November 3rd 03 07:25 AM


All times are GMT +1. The time now is 08:38 AM.

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

About Us

"It's about Microsoft Excel"