PDA

View Full Version : Solved: How to save a cell value to another sheet



Holland
03-24-2010, 08:30 AM
*** 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

mdmackillop
03-24-2010, 11:05 AM
Holland,
You should warn that running the code will create a file on the C Drive.
Regards
MD

SamT
03-24-2010, 11:43 AM
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.

Holland
03-24-2010, 01:50 PM
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

Holland
03-24-2010, 02:01 PM
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



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.

SamT
03-24-2010, 05:00 PM
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.