ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dumb question of the day. (https://www.excelbanter.com/excel-programming/339764-dumb-question-day.html)

DennisB

Dumb question of the day.
 
I am relatively new to VBA but am learning fast. One thing that I can't
find the answer to is what is the significance of the (.) in front of a
code.

eg; With ActiveSheet.OptionButtons("Option Button 57")
.Value = Not .Value = xlOn
End With

I cn understand having it between the Not.Value but why is it in the .Value
= etc.

Bewildered semi-Newbie

DennisB



JE McGimpsey

Dumb question of the day.
 
The . represents the object in the With statement.

.Value = Not .Value = xlOn

is equivalent to

ActiveSheet.OptionsButtons("Option Button 57").Value = Not _
ActiveSheet.OptionsButtons("Option Button 57").Value = xlOn

Using this notation only requires resolving the object once rather than
twice, as well as being much shorter.



In article ,
"DennisB" wrote:

I am relatively new to VBA but am learning fast. One thing that I can't
find the answer to is what is the significance of the (.) in front of a
code.

eg; With ActiveSheet.OptionButtons("Option Button 57")
.Value = Not .Value = xlOn
End With

I cn understand having it between the Not.Value but why is it in the .Value
= etc.

Bewildered semi-Newbie


Norman Jones

Dumb question of the day.
 
Hi Dennis,

eg; With ActiveSheet.OptionButtons("Option Button 57")


In the above line:

OptionButtons is the collection of option buttons
"Option Button 57" is a specific option button

and,therefo

ActiveSheet.OptionButtons("Option Button 57")

refers to a control named "Option Button 57", which is a member of the
OptionButtons collection on the active sheet,


---
Regards,
Norman



"DennisB" wrote in message
...
I am relatively new to VBA but am learning fast. One thing that I can't
find the answer to is what is the significance of the (.) in front of a
code.

eg; With ActiveSheet.OptionButtons("Option Button 57")
.Value = Not .Value = xlOn
End With

I cn understand having it between the Not.Value but why is it in the
.Value = etc.

Bewildered semi-Newbie

DennisB





Tom Ogilvy

Dumb question of the day.
 
..Value within the With / End With statement is equivalent to


ActiveSheet.OptionButtons("Option Button 57").Value = _
Not ActiveSheet.OptionButtons("Option Button 57").Value

The period means the part with the leading period is qualified by the object
in the With statement

Using With makes it simpler to write and in some cases could speed up
performance.

--
Regards,
Tom Ogilvy


"DennisB" wrote in message
...
I am relatively new to VBA but am learning fast. One thing that I can't
find the answer to is what is the significance of the (.) in front of a
code.

eg; With ActiveSheet.OptionButtons("Option Button 57")
.Value = Not .Value = xlOn
End With

I cn understand having it between the Not.Value but why is it in the

..Value
= etc.

Bewildered semi-Newbie

DennisB





Norman Jones

Dumb question of the day.
 
Hi Dennis,

My Apologies.

I missed the period between the parentheses and, therefore responded to an
imagined question rather than the one you posed.

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Dennis,

eg; With ActiveSheet.OptionButtons("Option Button 57")


In the above line:

OptionButtons is the collection of option buttons
"Option Button 57" is a specific option button

and,therefo

ActiveSheet.OptionButtons("Option Button 57")

refers to a control named "Option Button 57", which is a member of the
OptionButtons collection on the active sheet,


---
Regards,
Norman



"DennisB" wrote in message
...
I am relatively new to VBA but am learning fast. One thing that I can't
find the answer to is what is the significance of the (.) in front of a
code.

eg; With ActiveSheet.OptionButtons("Option Button 57")
.Value = Not .Value = xlOn
End With

I cn understand having it between the Not.Value but why is it in the
.Value = etc.

Bewildered semi-Newbie

DennisB







DennisB

Dumb question of the day.
 
Je McGimpsey, Norman & Tom.

Thanks for the answer guys. You cleared up everything for me. Appreciate
the help very much

DennisB
"Tom Ogilvy" wrote in message
...
.Value within the With / End With statement is equivalent to


ActiveSheet.OptionButtons("Option Button 57").Value = _
Not ActiveSheet.OptionButtons("Option Button 57").Value

The period means the part with the leading period is qualified by the
object
in the With statement

Using With makes it simpler to write and in some cases could speed up
performance.

--
Regards,
Tom Ogilvy


"DennisB" wrote in message
...
I am relatively new to VBA but am learning fast. One thing that I can't
find the answer to is what is the significance of the (.) in front of a
code.

eg; With ActiveSheet.OptionButtons("Option Button 57")
.Value = Not .Value = xlOn
End With

I cn understand having it between the Not.Value but why is it in the

.Value
= etc.

Bewildered semi-Newbie

DennisB








All times are GMT +1. The time now is 09:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com