Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default what does the operator ":=" mean?

in Office VB code:
what does the operator ":=" mean?

example:
Worksheets("Daily Targets").Range("A5:N5").Copy _
Destination:=Worksheets("Daily Targets").Range("A" & CStr(rowCounter))

i wrote this code but i copied the it from the HELP, & then i changed the
names & variables. BUT, i'd like to understand what does the operator := is
filling for, is it an object assigning or what ... i'm not sure ??!!!

regards,
Michael
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default what does the operator ":=" mean?

Probably the easiest way to explain it is that the colon (:) tells VBA that
it is not assigninng a variable. In other words if you entered this
statement:

Destination = Range("A1")

, then VBA would treat Destination as a variable and unless you put Set in
front of Destination it would give you an error message.

But with the colon and equal sign (:=) VBA knows that Destination is a
parameter of the Copy and Paste method and not a variable assignment.


"Michael/what does the operator ":=" mean" wrote:

in Office VB code:
what does the operator ":=" mean?

example:
Worksheets("Daily Targets").Range("A5:N5").Copy _
Destination:=Worksheets("Daily Targets").Range("A" & CStr(rowCounter))

i wrote this code but i copied the it from the HELP, & then i changed the
names & variables. BUT, i'd like to understand what does the operator := is
filling for, is it an object assigning or what ... i'm not sure ??!!!

regards,
Michael

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default what does the operator ":=" mean?

Hi,

It's the syntax for named arguments.

From help file:
A named argument consists of an argument name followed by a colon and an
equal sign (:=), followed by the argument value.

For more details search help using "Understanding Named and Optional
Arguments"

Cheers
Andy

Michael/what does the operator := mean wrote:
in Office VB code:
what does the operator ":=" mean?

example:
Worksheets("Daily Targets").Range("A5:N5").Copy _
Destination:=Worksheets("Daily Targets").Range("A" & CStr(rowCounter))

i wrote this code but i copied the it from the HELP, & then i changed the
names & variables. BUT, i'd like to understand what does the operator := is
filling for, is it an object assigning or what ... i'm not sure ??!!!

regards,
Michael


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,365
Default what does the operator ":=" mean?

Just to confuse matters further. Using named arguments allows you to just
enter the non-default arguments for a command and enter them in any order
rather than having to enter something for every possible argument and to have
to do it in a particular order. The := tells the VBA engine that what
follows is a value to be used as the specific argument indicated by the entry
on the left side of the := indicator.

"Michael/what does the operator ":=" mean" wrote:

in Office VB code:
what does the operator ":=" mean?

example:
Worksheets("Daily Targets").Range("A5:N5").Copy _
Destination:=Worksheets("Daily Targets").Range("A" & CStr(rowCounter))

i wrote this code but i copied the it from the HELP, & then i changed the
names & variables. BUT, i'd like to understand what does the operator := is
filling for, is it an object assigning or what ... i'm not sure ??!!!

regards,
Michael

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
Text "comparison" operator for "contains" used in an "IF" Function Pawaso Excel Worksheet Functions 4 April 4th 23 11:35 AM
Is it possible to apply IF's to "operator" result.. nastech Excel Discussion (Misc queries) 3 August 11th 06 02:12 PM
program stuck at "Save Cancelled by Operator" MainelyPat Excel Discussion (Misc queries) 3 April 20th 06 06:23 PM
How 2 use right shift "<<" and left shift "" operator in excel? v-2ajpau Excel Programming 2 December 28th 05 01:33 PM
Excel no longer allows new formulas with division "/" operator SA Excel Programming 1 November 1st 03 07:07 AM


All times are GMT +1. The time now is 02:49 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"