+ Reply to Thread
Results 1 to 4 of 4

How to assign a number to a cell in another sheet by clicking an object?

  1. #1
    Registered User
    Join Date
    07-26-2007
    Posts
    1

    How to assign a number to a cell in another sheet by clicking an object?

    I have a workbook with three sheets. In sheet 1 I have cell A1 where a macro controlled number will be found. In sheet 2 and 3 I have option buttons, called on and off (2 buttons in each sheet).

    When I click the "ON-button" (in sheet 2) I want a macro to type a value of 1 in cell A1 in sheet 1. When I click the OFF button in sheet 2 I want another macro to type 0 in the same A1 cell in sheet 1. When clicking any of the two buttons I want to remain in sheet 2 so I don't end up in sheet 1 or experience "flashing" back and forth navigation between the two sheets.

    I want to achieve the same things in sheet 3, preferrable, by using the same two macros. Clicking ON will set A1 in sheet 1 to value 1 and clicking OFF will set A1 in sheet 1 to value 0. Here too I want to remain in the sheet where the two buttons are.

    Any help will of course be mostly appreciated.

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    See the attached file... I hope it's what you need.

    Regards,
    Antonio
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    05-11-2007
    Posts
    4
    Thank you Antonio,

    It is at least part of what I need. However, I have a few related questions that I hope you can help me with too.

    1. Where can I find/edit the macro code (I normally go "tools", "macros", "play" and then choose the macro to edit from the list?
    2. How come I can't move/select the option buttons in the sheets?
    3. The default values of the 4 buttons should be off (and therefore 0 in sheet 1). They should not be blank as they are now.
    4. Sheet 1 is not affected when clicking the buttons in sheet 3. I would like sheet 3 to have the same impact upon sheet 1 as sheet 2 has.

    Thank you!

  4. #4
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    See the new attached file... it may fix your problems.

    Now I try to answer to your questions:
    1. In the previous file I used events to get modifications of option buttons. To see that macro you need to click right mouse on sheet label (for example 'sheet2') and select 'view code'.
    2. I took the previous option button from the visual basic toolbar. To move that you need to click the square icon on visual basic toolbar
    3. Visual basic option button can't have backcolor different from white.
    4. Problem now fixed. I apologize for my distraction in the previous attached file.

    I hope it can help.

    Regards,
    Antonio
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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