+ Reply to Thread
Results 1 to 2 of 2

Compile Error: Wrong number of arguments or invalid property assignment .... help!

Hybrid View

  1. #1
    Registered User
    Join Date
    04-01-2013
    Location
    bethesda
    MS-Off Ver
    Excel 2010
    Posts
    6

    Question Compile Error: Wrong number of arguments or invalid property assignment .... help!

    I have 2 sheets in a workbook. the first sheet is Checklist2 and the 2nd sheet is Results (2). I have Rounded Rectangle Obects on the sheet Checklist 2. What i want is, when someone clicks on a rounded Rectangle Obect it goes to Results (2) sheet and puts in "TRUE" in cell R8, then goes back to the original sheet Checklist2 and changes the color of the rounded rectangle object to green. The name of the rounded rectangle object is Rounded Rectangle 16. I assigned a macro to the Rounded Rectangle Object, so when someone clicks on it, it runs the macro. Why am i getting a compile error?????
    Any help anyone could provide would be greatly apprecaited. :Here is my code:

    Sub Rounded_Rectangle_16_Yes()
    '
    Rounded_Rectangle_16_Yes Macro
    '
    Sheets("Results (2)").Select
    Range("R8").Select
    ActiveCell.FormulaR1C1 = "TRUE"
    Range("R9").Select
    Sheets("Checklist2").Select
    ActiveSheet.Shapes.Range(Array("Rounded Rectangle 16")).Select
            .Visible = msoTrue
            .ForeColor.RGB = RGB(0, 176, 80)
            .Transparency = 0
            .Solid
        End With
    End Sub
    Last edited by Leith Ross; 04-01-2013 at 03:09 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Compile Error: Wrong number of arguments or invalid property assignment .... help!

    Hello powercell99,

    Welcome to the Forum!

    Here is your macro with a few revisions. It is rare in VBA to have to activate or select an object before an action is performed on it. This is why your macro is shorter.
    Sub Rounded_Rectangle_16_Yes()
    '
    'Rounded_Rectangle_16_Yes Macro
    '
        Sheets("Results (2)").Range("R8").FormulaR1C1 = "TRUE"
        
        With ActiveSheet.Shapes("Rounded Rectangle 16")
            .Visible = msoTrue
            .Fill.ForeColor.RGB = RGB(0, 176, 80)
            .Fill.Transparency = 0
            .Fill.Solid
        End With
        
    End Sub
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1