Consulting

Results 1 to 6 of 6

Thread: Solved: How to save a cell value to another sheet

  1. #1
    VBAX Regular
    Joined
    Oct 2008
    Posts
    41
    Location

    Solved: How to save a cell value to another sheet

    *** PLEASE NOTE: Running this file will create a new TXT file on your C-Drive ***

    I have a 2 sheets in my workbook, sheet 2 is hidden (please see attached).

    Currently I have cell F2 being saved to:

    "Create 'C:\" & ThisWorkbook.Name & _
    " Counter.txt' File")

    How can I have this saved with in the same workbook under Sheet 2 "ReqNum"? Question I as is I want to customize a form for different users and each form will be Unique. Workbook will be saved on various pen-drives and used on various computers. That is why I would like to save within the same workbook.

    Catch: If the person decides not to save the workbook or do a save as I still would like the number in cell F2 saved somehow on both sheets.

    Any help would be greatly appreciated.

    Thank you,
    Holland
    Last edited by Holland; 03-24-2010 at 01:52 PM.

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Holland,
    You should warn that running the code will create a file on the C Drive.
    Regards
    MD
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Why didn't you tell me that the example workbook would put a file on MY C:\ drive????????????? What if I was a noob who couldn't read VB??????????????

    Right now, your procedure saves a number to text file on C:\ that shows how many times some copy of this workbook has been opened on the computor C:\ is on.

    Why do you also want to save that info on the thumb drive? Every time the workbook is opened on a different computor, the info will be updated to show the activity of that computor and not the activity of the thumbdrive.

    However, to answer your question, the line
    Me.Save
    anywhere in your code will save the workbook when that line is run.
    Last edited by SamT; 03-24-2010 at 12:03 PM.

  4. #4
    VBAX Regular
    Joined
    Oct 2008
    Posts
    41
    Location
    All SORRY,
    Please note that running this file will create a TXT file on your C Drive... Can I somehow delete this thread and post a new thread?

    agn my apologies...
    Holland

  5. #5
    VBAX Regular
    Joined
    Oct 2008
    Posts
    41
    Location
    Hi Sam,
    My apologies agn,.. I would like to save the code within the same work book, sheet 2 ReqNum.

    Will Me.Save still work even if the file is not saved by the user and/or they use save as?

    Thank you,
    Holland


    Quote Originally Posted by SamT
    Why didn't you tell me that the example workbook would put a file on MY C:\ drive????????????? What if I was a noob who couldn't read VB??????????????

    Right now, your procedure saves a number to text file on C:\ that shows how many times some copy of this workbook has been opened on the computor C:\ is on.

    Why do you also want to save that info on the thumb drive? Every time the workbook is opened on a different computor, the info will be updated to show the activity of that computor and not the activity of the thumbdrive.

    However, to answer your question, the line
    Me.Save
    anywhere in your code will save the workbook when that line is run.

  6. #6
    VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Holland,

    Thank you for the warning edit.

    When the User does a Save As, the original is closed and the new becomes the open workbook. In that case "Me.Save" saves the new workbook.

    If you put the "Me.Save" in the Workbook open event, it will be saved back to itself before the User can Save As.

Posting Permissions

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