Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Vispy
 
Posts: n/a
Default Using variables in a name

Hello,

Does anyone know how to used a variable in a name?

My example would by:

' fname is short for the name to be given to the newly saved file.
Dim fname$
' dt is short for the date.
Dim dt$
' mth is short for the month.
Dim mth$

mth = 1
yr = 2006

fname = "Labor-Work-mth-yr"

I would like to have fname appear as Labor-Work-01-2006.


Thanks!!


  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Using variables in a name

fname = "Labor-Work-" & Format(mth,"00") "-" % Format(yr,"0000")

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"Vispy" wrote in message
...
Hello,

Does anyone know how to used a variable in a name?

My example would by:

' fname is short for the name to be given to the newly saved file.
Dim fname$
' dt is short for the date.
Dim dt$
' mth is short for the month.
Dim mth$

mth = 1
yr = 2006

fname = "Labor-Work-mth-yr"

I would like to have fname appear as Labor-Work-01-2006.


Thanks!!




  #3   Report Post  
Posted to microsoft.public.excel.misc
Kevin Vaughn
 
Posts: n/a
Default Using variables in a name

fname = "Labor-Work-" & mth & "-" & yr

mth = 1
yr = 2006

fname = "Labor-Work-mth-yr"

I would like to have fname appear as Labor-Work-01-2006.

--
Kevin Vaughn


"Vispy" wrote:

Hello,

Does anyone know how to used a variable in a name?

My example would by:

' fname is short for the name to be given to the newly saved file.
Dim fname$
' dt is short for the date.
Dim dt$
' mth is short for the month.
Dim mth$




Thanks!!



  #4   Report Post  
Posted to microsoft.public.excel.misc
Vispy
 
Posts: n/a
Default Using variables in a name

Thanks to Bob & Kevin!!

"Vispy" wrote in message
...
Hello,

Does anyone know how to used a variable in a name?

My example would by:

' fname is short for the name to be given to the newly saved file.
Dim fname$
' dt is short for the date.
Dim dt$
' mth is short for the month.
Dim mth$

mth = 1
yr = 2006

fname = "Labor-Work-mth-yr"

I would like to have fname appear as Labor-Work-01-2006.


Thanks!!



  #5   Report Post  
Posted to microsoft.public.excel.misc
Kevin Vaughn
 
Posts: n/a
Default Using variables in a name

You're welcome. Although I did miss the 0 before the month part.
--
Kevin Vaughn


"Vispy" wrote:

Thanks to Bob & Kevin!!

"Vispy" wrote in message
...
Hello,

Does anyone know how to used a variable in a name?

My example would by:

' fname is short for the name to be given to the newly saved file.
Dim fname$
' dt is short for the date.
Dim dt$
' mth is short for the month.
Dim mth$

mth = 1
yr = 2006

fname = "Labor-Work-mth-yr"

I would like to have fname appear as Labor-Work-01-2006.


Thanks!!






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA reseting variables Jeff Excel Discussion (Misc queries) 0 February 4th 06 08:22 PM
VBA reseting variables bpeltzer Excel Discussion (Misc queries) 0 February 4th 06 03:52 PM
Passing Variables Jeff Excel Discussion (Misc queries) 1 November 4th 05 06:46 PM
How do I use variables in Excel? XUT67 Excel Discussion (Misc queries) 4 July 22nd 05 09:04 PM
How do I use variables in Excel? XUT67 New Users to Excel 2 July 21st 05 05:09 PM


All times are GMT +1. The time now is 01:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"