Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8257631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:15:50+00:00 2026-06-08T02:15:50+00:00

Like C/CPP/CSharp/JScript, how can we do chained assignment in VBA? In other words, does

  • 0

Like C/CPP/CSharp/JScript, how can we do chained assignment in VBA? In other words, does VBA have right-associativity of assignment operator?

For example in C-sharp and JavaScript, we can use:

var alpha, bravo, charlie;
alpha = bravo = charlie = "hello";

Now writing this expression in VBA would have to:

Dim alpha, bravo, charlie
alpha = "hello"
bravo = "hello"
charlie = "hello"

But we can’t use:

Dim alpha, bravo, charlie
alpha = bravo = charlie = "hello"

VBA doesn’t allow to collapse the expressions. Is there any other way to do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T02:15:53+00:00Added an answer on June 8, 2026 at 2:15 am

    No, VBA doesn’t have the right-associativity for assignment operator. However, VBA does have the right-associativity or chaining operations for other logical operators. Consider the following expression:

    alpha = 3
    bravo = 5
    charlie = 4
    
    alpha = bravo < charlie
    
    MsgBox(alpha) 'would display false
    
    alpha = 3
    bravo = 5
    charlie = 4
    
    alpha = bravo > charlie < alpha
    
    MsgBox(alpha) 'would display ture .. because (bravo > charlie) is true 
                                          'and true (or 1) less than alpha
    

    However, VBA interpreter prioritize the comparison operator over assignment operator, both are represented by =. To wit,

    alpha = bravo = "hello"
    MsgBox(alpha) 'would display false, because bravo <> "hello"
    

    Thus, you need to use multiple statements explicitly for assignment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How does something like this get initialized in Cpp, when in my main ,
I have a code like this below in /root_project/main.cpp : #include theoraplayer/TheoraVideoClip.h unsigned int
I have a (partial) qmake project file like this: TEMPLATE=lib TARGET=whatever SOURCES=whatever.cpp HEADERS=whatever.h This
I have a declaration in a cpp where a function is like: virtual void
I would like to create a thread pool. I have a class called ServerThread.cpp,
I have a cpp file like this: #include Foo.h; Foo::Foo(int a, int b=0) {
Let's assume I have directories like: dir1 main.cpp dir2 abc.cpp dir3 def.cpp dir4 ghi.cpp
I have a simple file stlTest2.cpp like this: #include <jni.h> #include <cmath> bool isnan
I have a main.cpp like so: #include <boost/python.hpp> const char* greeting() { return Hello
So I have code like: // puma.cpp #include FILE_WITH_MACROS.hpp ANIMAL_MACROS_NAME_HERE class puma : public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.