VBE - What that "False" means in this code?

Discussion in 'Programmer's Corner' started by atferrari, Sep 18, 2013.

  1. atferrari

    Thread Starter AAC Fanatic!

    Jan 6, 2004
    2,648
    762
    Visual Basic for Excel

    In my worksheet I got those 30 shapes and when I run the macro they all get selected.

    My question: what the "False" means?

    Code ( (Unknown Language)):
    1.  
    2. Sub Macro17()
    3. '
    4. ' Macro17 Macro
    5. ' Macro grabada el 17/9/2013 por Agustín
    6.  
    7.     ActiveSheet.Shapes.Range(Array("Oval 1", "Oval 2", "Oval 3", "Oval 4" _
    8.     , "Oval 5", "Oval 6", "Oval 7", "Oval 8" _
    9.     , "Oval 9", "Oval 10", "Oval 11", "Oval 12" _
    10.     , "Oval 13", "Oval 14", "Oval 15", "Oval 16")).Select
    11.     ActiveSheet.Shapes.Range(Array("Oval 17", "Oval 18", "Oval 19", "Oval 20" _
    12.     , "Oval 21", "Oval 22", "Oval 23", "Oval 24" _
    13.     , "Oval 25", "Oval 26", "Oval 27", "Oval 28" _
    14.     , "Oval 29", "Oval 30")).Select [COLOR=Red]False[/COLOR]
    15. End Sub
    16.  
    I could not make any sense of it. :(
     
  2. sirch2

    Well-Known Member

    Jan 21, 2013
    1,008
    351
    The False just stops the second select replacing the first, i.e. it extends the selection.

    Look at docs for the Select method of the ShapeRange class. The fact that you can use "select false" instead of "select(false)" is just a hang over from ancient BASIC
     
    atferrari likes this.
  3. atferrari

    Thread Starter AAC Fanatic!

    Jan 6, 2004
    2,648
    762
    Thanks for replying. Worked with Turbo Basic in the past but I do not recall that use thus I did not recognize it at all. MIcrosoft help online confirmed and explained that.

    In the macro at the OP and in the one below, I realized that the False is used for a clerical reason: there is a limit for the allowed line continuations (24 in my version) making necessary to extend (not replace) the first selection.

    Code ( (Unknown Language)):
    1.  
    2. Sub Macro9()
    3.  
    4. ' Code tidied by me.
    5.  
    6.     ActiveSheet.Shapes.Range(Array("Rectangle 736", "Rectangle 737", "Rectangle 738", "Rectangle 739" _
    7.     , "Rectangle 740", "Rectangle 741", "Rectangle 742", "Rectangle 743", "Rectangle 744", "Rectangle 745" _
    8.     , "Rectangle 746", "Rectangle 747", "Rectangle 748", "Rectangle 749", "Rectangle 750", "Rectangle 751" _
    9.     , "Rectangle 752", "Rectangle 753", "Rectangle 754", "Rectangle 755", "Rectangle 756", "Rectangle 757" _
    10.     , "Rectangle 758", "Rectangle 759", "Rectangle 760", "Rectangle 761", "Rectangle 762", "Rectangle 763" _
    11.     , "Rectangle 764", "Rectangle 765", "Rectangle 766", "Rectangle 767", "Rectangle 768", "Rectangle 769" _
    12.     , "Rectangle 770", "Rectangle 771", "Rectangle 772", "Rectangle 773", "Rectangle 774", "Rectangle 775" _
    13.     , "Rectangle 776", "Rectangle 777", "Rectangle 778", "Rectangle 779", "Rectangle 780", "Rectangle 781" _
    14.     , "Rectangle 782", "Rectangle 783", "Rectangle 784", "Rectangle 785", "Rectangle 792", "Rectangle 793" _
    15.     , "Rectangle 794", "Rectangle 795", "Rectangle 796", "Rectangle 797", "Rectangle 798", "Rectangle 799")).Select
    16.    
    17.     ActiveSheet.Shapes.Range(Array("Rectangle 800", "Rectangle 801", "Rectangle 802", "Rectangle 803" _
    18.     , "Rectangle 804", "Rectangle 805", "Rectangle 806", "Rectangle 807", "Rectangle 808", "Rectangle 809" _
    19.     , "Rectangle 810", "Rectangle 811", "Rectangle 818", "Rectangle 819", "Rectangle 820", "Rectangle 821" _
    20.     , "Rectangle 822", "Rectangle 823", "Rectangle 824", "Rectangle 825", "Rectangle 826", "Rectangle 827" _
    21.     , "Rectangle 828", "Rectangle 829", "Rectangle 830", "Rectangle 831", "Rectangle 832", "Rectangle 833" _
    22.     , "Oval 197", "Oval 198", "Oval 199", "Oval 200", "Oval 201", "Oval 202", "Oval 203", "Oval 204" _
    23.     , "Oval 205", "Oval 206", "Oval 207", "Oval 208", "Oval 209", "Oval 210", "Oval 211", "Oval 212" _
    24.     , "Oval 213", "Oval 214", "Oval 219", "Oval 220", "Oval 221", "Oval 222", "Oval 223", "Oval 224" _
    25.     , "Oval 225", "Oval 226", "Oval 227", "Oval 228", "Oval 229", "Oval 230", "Oval 231", "Oval 232" _
    26.     , "Oval 233", "Oval 234", "Oval 235", "Oval 236", "Oval 237", "Oval 238", "Oval 239", "Oval 240" _
    27.     , "Oval 241", "Oval 242", "Oval 243", "Oval 244", "Oval 245")).Select False
    28. End Sub
    29.  
    Clear to me now. Gracias again. :)
     
  4. sirch2

    Well-Known Member

    Jan 21, 2013
    1,008
    351
    No worries. IIRC some versions of BASIC handled subroutine calls differently to function calls. subroutines were called without brackets where as functions were called with brackets. These days pretty much everyone calls both with brackets
     
Loading...