+ Reply to Thread
Results 1 to 6 of 6

Macro, want to get values from a cell without changing sheets

  1. #1
    Registered User
    Join Date
    03-25-2009
    Location
    San Jose
    MS-Off Ver
    Excel 2007
    Posts
    83

    Macro, want to get values from a cell without changing sheets

    Made a macro to Copy a value and paste is as "Special" for Value only.

    The problem is it won't function correctly Unless I force a switch to the sheet where the calculations are. (Which I want to avoid)

    The current code is:

    Please Login or Register  to view this content.
    Is there a way to do this without switching sheets as that page will be hidden?
    Last edited by D3Pratt; 03-28-2009 at 01:51 AM. Reason: Solved now

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro help please

    Please take a few minutes to read the forum rules about thread titles, and then amend yours accordingly.

    [added by pjoaquin]: Also, please remember to post your questions in the proper forum. I've moved this thread to the Programming forum this time.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Macro help please

    Thanks for updating your title, D.

    Are you simply trying to copy the value in Calc!C10 to Calc!D10?

    Rather than using Select statements (almost always unnecessary), or copying/pasting, just set the value of D10 equal to C10. For example:
    Please Login or Register  to view this content.
    Hope that helps.

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: Macro help please, want to get values from a cell without changing sheets

    No need to select sheets or ranges
    No need to copy & paste

    To copy value between sheets
    Please Login or Register  to view this content.
    To copy value on same sheet
    Please Login or Register  to view this content.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  5. #5
    Registered User
    Join Date
    03-25-2009
    Location
    San Jose
    MS-Off Ver
    Excel 2007
    Posts
    83

    Re: Macro help please, want to get values from a cell without changing sheets

    The specifics of what I'm trying to do is this:
    (And since I'm a noob I'm probably doing it all backwards)

    On the UserForm I have 2 buttons:

    First one writes a Now() to Calc!C8
    Second one writes a Now() to Calc!C9
    Calc!C10 the subtracts 8 from 9 to get an elapsed time.

    When I set ControlSource of TextBoxDisplay to Calc!F4 it would overwrite the formula and effectively break the function

    So, I did a macro to Copy and paste the Value only in a cell next to the formula, but that macro now HAS to have the Sheet open that will eventually be hidden.

    I'm working on a new workaround and linking that cell to the main page and will Hide it somehow, but it's clunky, I don't like it.

  6. #6
    Registered User
    Join Date
    03-25-2009
    Location
    San Jose
    MS-Off Ver
    Excel 2007
    Posts
    83

    Re: Macro help please, want to get values from a cell without changing sheets

    Quote Originally Posted by mudraker View Post
    No need to select sheets or ranges
    No need to copy & paste

    To copy value between sheets
    Please Login or Register  to view this content.
    To copy value on same sheet
    Please Login or Register  to view this content.
    That did it, but I had to swap the cell reference:

    Please Login or Register  to view this content.
    Seems that with C10 in front it started off by overwriting the formula with the contents of an empty cell.

    Thank you greatly!

+ 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