Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using Excel cell content for naming a file

Status
Not open for further replies.

vuxsa

Technical User
Oct 26, 2011
1
FR
Hi all,

First time here, so big hello to all Forum members. I need a code that will take a content of a specified cell (A1 for example) and place it in clipboard - content is not function, but is formatted in certain way, to be exact it's formatted as a date; that content should be next used for:
1. to rename active sheet in a manner:
"sheet name" + content - where "sheet name" is constant, while content is of course changeable (example, if I put date 01.01. in specified cell, sheet should be named "Created on 01.01.)
2. to rename file itself in the same manner, and to save it as such.
It will also help me if this code could be written with a slight variation - instead of taking content of a specified cell, date should be entered via input box and used in the same way as described above with addition that in this case first thing would be to enter the value from input box to a specified cell (ex. A1), and then for renaming sheet and file.

Please, write me both codes.

Much thanks!
 
Welcome to the forums!

You won't need to copy to the value to the clipboard, you can store it in a variable.

As this isn't a free code resource, could you show us what you have so far and where we can help you with it?

Regards



Andy
---------------------------------
Zebracorn: 50% Zebra, 50% Unicorn = 100% Real.

 
hi
harleyquinn is right in stating this isn't a free code resource (hark me, vist about twice a year now and start preaching accepted practice straight away!!)

however the following will get you started
Code:
ActiveSheet.Name = "Created " & Format(CDate(InputBox("Input Date", "Input Date")), "ddd dd-mm-yyyy")

good luck!

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
I have a few thoughts but want to know something - are you new to excel or do you code often?

If you code often I will assume you know basics and are somewhere around an intermediate level give or take, but if you are new or newer to excel I will include basic explinations.
 
Welcome to the forum.

Another good idea, which you will often see suggested here, is - Record a Macro.

In other words, switch on the macro recorder (if you're not sure how, see the help). Then do manually what you want to do in code.

Stop recording and look at the code created. In some cases, you may simply be able to use the recorded macro to do exactly what you want. In others you will need to modify it, but at least it gives you a good start in figuring out how to access and control the relevant workbook objects.

Tony
 


And yet another sugestion:

When describing your problem, refrain from imposting your perception on HOW it should be done.

Rather, explain WHAT you expect the result to be and WHAT the initial conditions are. The experts can then tell you the HOW(s).

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top