Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default a few simple newbies questions

Hello out there,

I am just getting into seriously editing my makros in VBA and I
encounter a few things I'd like to know and which must be easy answers
for those who know.

1. if I pass an object, say a worksheet to a sub-routine will it be
passed by value or will it be passed by reference. What I want to know:
If I make changes on that passed worksheet will they be there in the
routine that called and passed the sub-routine? My guess: pass by reference.

2. Where is a good place to look up all I need to know about functions
and subs, about objects, their methods and attribs in VBA? Where can I
read about returned values and arguments? I can't believe the object
catalog is the best I can get....

3. How do I place a formula in a cell?


Thanks so far
Marco

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default a few simple newbies questions

Marco,

1) By default, everything is passed by reference. With objects,
if you specify ByVal, the address of the object is passed by
value. If you specify ByRef, the address of the object is passed
by reference. In both cases, you change the properties of the
object. The difference is that with ByVal, you can't assign the
parameter to a difference object and have that change take effect
in the calling procedure.

2) The VBA help files are fairly good.

3) Use the Formula or FormulaLocal property of the Range to place
a formula in a cell. E.g.,

Range("A1").Formula = "=SUM(B1:B10)"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Marco Braun" wrote in message
...
Hello out there,

I am just getting into seriously editing my makros in VBA and I
encounter a few things I'd like to know and which must be easy

answers
for those who know.

1. if I pass an object, say a worksheet to a sub-routine will

it be
passed by value or will it be passed by reference. What I want

to know:
If I make changes on that passed worksheet will they be there

in the
routine that called and passed the sub-routine? My guess: pass

by reference.

2. Where is a good place to look up all I need to know about

functions
and subs, about objects, their methods and attribs in VBA?

Where can I
read about returned values and arguments? I can't believe the

object
catalog is the best I can get....

3. How do I place a formula in a cell?


Thanks so far
Marco



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default a few simple newbies questions

1. in order for the sub not to modify the variable you must use byval..
ex.
Sub DontChangeMe(ByVal <variable as <type)

It doesn't matter what the name of the subs variable is, thus the point of
subs and not hardcoding regularly used routines in main code.


2. see vba help files per the application you want to learn. I've come a
long way myself.

2. see vba help files per the application you want to learn...just joking.
ThisWorkbook.Worksheets("MY worksheet").Cells(6, 1).Formula =
"=sum(A1:A5)"
NOTE:
[6,1] = Row 6, Column 1


ricky


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default a few simple newbies questions

Hey Chip,

thank you for your quick reply...

3) Use the Formula or FormulaLocal property of the Range to place
a formula in a cell. E.g.,

Range("A1").Formula = "=SUM(B1:B10)"


this works fine, but what are the other Formulas:

FormulaR1C1
Formula1
Formula2
FormulaLocal

???
wonders on
Marco

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default a few simple newbies questions

Marco,

The FormulaR1C1 property is used for entering formulas in R1C1
style notation rather than A1 style notation. FormulaLocal is
used to enter a formula in the locale language (e.g., German or
French). Formula1 and Formula2 are used to create Data Validation
or Conditional Formatting conditions in a cell.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Marco Braun" wrote in message
...
Hey Chip,

thank you for your quick reply...

3) Use the Formula or FormulaLocal property of the Range to

place
a formula in a cell. E.g.,

Range("A1").Formula = "=SUM(B1:B10)"


this works fine, but what are the other Formulas:

FormulaR1C1
Formula1
Formula2
FormulaLocal

???
wonders on
Marco



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
Questions should be simple please help babiigirl Excel Worksheet Functions 3 June 14th 06 07:24 PM
Complex lookup task for a newbies nhwong Excel Worksheet Functions 5 November 9th 04 04:05 PM
Simple Questions James[_17_] Excel Programming 3 December 7th 03 04:22 PM
Several simple questions Stuart[_5_] Excel Programming 1 September 14th 03 08:58 PM
Simple VB and Excel questions Kevin Excel Programming 1 August 5th 03 08:40 PM


All times are GMT +1. The time now is 04:26 PM.

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"