+ Reply to Thread
Results 1 to 12 of 12

Reference another sheet in code/creating command button to manually store old cell value

  1. #1
    Registered User
    Join Date
    06-18-2022
    Location
    Ohio
    MS-Off Ver
    Office 365
    Posts
    8

    Reference another sheet in code/creating command button to manually store old cell value

    Disclaimer: I am not a programmer, I just find code and attempt to adapt it to my needs.

    I found the following code that works for my purpose of saving updating cell values each week, but have run into two problems making it work for my spreadsheet:

    1. I need to reference a second sheet for "A4" as A4 is not on the same worksheet as A1, but the code doesn't like something like "Calc"!A4 to point to the other sheet named Calc.
    2. I need to create a button to do this "save" manually, but have never used ActiveX command button's before. Not sure where to start there. If its not manual, then it will log a saved entry into my A column on Calc sheet each time I enter a new number on other sheets as A1 is calculated from other cells.
    Any help would be greatly appreciated!

    Code I found that works partially: "Say we start with A1 and A4 both empty. The following Event macro will allow you to enter a value in A1 and have it appear in A4. Each time the value in A1 is changed, then new value will be copied into the first empty cell below A4. Enter the following event macro in the worksheet code area:"

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    12-10-2013
    Location
    Mississippi, United States
    MS-Off Ver
    2016
    Posts
    120

    Re: Reference another sheet in code/creating command button to manually store old cell val

    Just based on the information provied

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    12-10-2013
    Location
    Mississippi, United States
    MS-Off Ver
    2016
    Posts
    120

    Re: Reference another sheet in code/creating command button to manually store old cell val

    Should have said in my last post. But to have VBA look at a worksheet use
    Please Login or Register  to view this content.
    Similar to workbooks
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    06-18-2022
    Location
    Ohio
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Reference another sheet in code/creating command button to manually store old cell val

    Quote Originally Posted by aworfolk View Post
    Just based on the information provided
    Thanks for answering and attempting to solve my problem #1! But that didn't seem to work. I did change the cells to fit my spreadsheet. Did I change something incorrectly? The cells used are D11 on the sheet where I'm putting the code, and U3 on Calc sheet.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    12-10-2013
    Location
    Mississippi, United States
    MS-Off Ver
    2016
    Posts
    120

    Re: Reference another sheet in code/creating command button to manually store old cell val

    I have a question? The "N" are you pulling the last row if so try this

    Please Login or Register  to view this content.
    Last edited by aworfolk; 08-18-2022 at 12:47 PM. Reason: Changed code fix

  6. #6
    Forum Contributor
    Join Date
    12-10-2013
    Location
    Mississippi, United States
    MS-Off Ver
    2016
    Posts
    120

    Re: Reference another sheet in code/creating command button to manually store old cell val

    I found an error when testing a bit more

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-18-2022
    Location
    Ohio
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Reference another sheet in code/creating command button to manually store old cell val

    Quote Originally Posted by aworfolk View Post
    I found an error when testing a bit more
    No go on that one either. Not sure on the N answer. I'm always pulling from D11 and trying to put the results down the column on Calc U3 (and down). Hang on, I'll deidentify the spreadsheet and post it.

    Scorecard.xlsm
    Last edited by Rolaids24; 08-18-2022 at 01:23 PM.

  8. #8
    Forum Contributor
    Join Date
    12-10-2013
    Location
    Mississippi, United States
    MS-Off Ver
    2016
    Posts
    120

    Re: Reference another sheet in code/creating command button to manually store old cell val

    Paste the following in WBR (West)

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-18-2022
    Location
    Ohio
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Reference another sheet in code/creating command button to manually store old cell val

    Quote Originally Posted by aworfolk View Post
    Paste the following in WBR (West)

    Please Login or Register  to view this content.
    Thanks but that didn't work either. I made sure to remove all code from the other worksheets as well. I appreciate your help and trying! Did it work for you on my spreadsheet?

  10. #10
    Forum Contributor
    Join Date
    12-10-2013
    Location
    Mississippi, United States
    MS-Off Ver
    2016
    Posts
    120

    Re: Reference another sheet in code/creating command button to manually store old cell val

    Sorry I got busy with work. I have uploaded the file.

    What I have done to the code is made it so when you up date the information on the west page
    it will run the code since that seems to be the source of the information.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-18-2022
    Location
    Ohio
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Reference another sheet in code/creating command button to manually store old cell val

    Quote Originally Posted by aworfolk View Post
    Sorry I got busy with work. I have uploaded the file.

    What I have done to the code is made it so when you up date the information on the west page
    it will run the code since that seems to be the source of the information.
    Sorry for the delay. Thank you very much for your work on this. The code you used definitely records the current variance number, however it doesn't record future variance numbers down the U column when we add weekly numbers to the next column ("WBR West" column ID) or the next one, and so on, on the WBR. Which is why I was wanting to tie it to the D11 number on the Stats sheet, because that number will always reflect the updated variance calculation. Does that make sense? This also will be done for the East variance ("Stats" I11).

  12. #12
    Forum Contributor
    Join Date
    12-10-2013
    Location
    Mississippi, United States
    MS-Off Ver
    2016
    Posts
    120

    Re: Reference another sheet in code/creating command button to manually store old cell val

    Lets try this then. Delete any old Code in the workbook and paste the following in the Stats page:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by aworfolk; 08-22-2022 at 12:58 PM. Reason: Uploaded Workbook

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Copying ActiveX Command Button from master sheet to subsheets. command button code missing
    By popper08 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-13-2020, 10:15 AM
  2. Replies: 1
    Last Post: 12-10-2020, 10:48 AM
  3. [SOLVED] Formula or command button to manually calculate a workbook
    By thedunna in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-04-2019, 09:01 PM
  4. Command button cell reference.
    By milo1984 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-06-2013, 05:25 PM
  5. Creating a Command button and assigning code to it
    By neallp31 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-25-2013, 05:58 PM
  6. Trying to Give New Command Button Code from Another Sheet's Code
    By MegaRush in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-10-2012, 09:43 AM
  7. Store cell reference in sheet to update formula
    By frostie77 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-17-2011, 11:23 AM

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