#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default month name

Hi, using an input box in vba, were a date ia added, I want to name
worksheets based on the month of the given date. For example if
21/6/08 was entered, then my worksheet will be called June. How do I
get the information using vba.
Regards Robert
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 449
Default month name

Hi Robert

Sub test()
Dim D As Date
D = DateSerial(2008, 6, 21)
MsgBox D
MsgBox Format$(D, "mmmm")
End Sub

Best wishes Harald

"RobcPettit" wrote in message
...
Hi, using an input box in vba, were a date ia added, I want to name
worksheets based on the month of the given date. For example if
21/6/08 was entered, then my worksheet will be called June. How do I
get the information using vba.
Regards Robert


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default month name

hi
something like this might work
Sub robcpettit()
Dim m As String
Dim ib As String
ib = InputBox("enter date")
m = WorksheetFunction.Text(ib, "mmmm")
Sheets("sheet1").Name = m
End Sub

regards
FSt1
"RobcPettit" wrote:

Hi, using an input box in vba, were a date ia added, I want to name
worksheets based on the month of the given date. For example if
21/6/08 was entered, then my worksheet will be called June. How do I
get the information using vba.
Regards Robert

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default month name

hi
if sheets("sheet1").name = m isn't what you want(sheet specific). try this..
activesheet.name = m

regards
FSt1

"FSt1" wrote:

hi
something like this might work
Sub robcpettit()
Dim m As String
Dim ib As String
ib = InputBox("enter date")
m = WorksheetFunction.Text(ib, "mmmm")
Sheets("sheet1").Name = m
End Sub

regards
FSt1
"RobcPettit" wrote:

Hi, using an input box in vba, were a date ia added, I want to name
worksheets based on the month of the given date. For example if
21/6/08 was entered, then my worksheet will be called June. How do I
get the information using vba.
Regards Robert

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default month name

here's one way:

Sub test()
Dim dt As Date
dt = InputBox("Enter Date")
Worksheets("sheet1").Name = MonthName(Month(dt))
End Sub

or

Sub test()
Dim dt As Date
dt = InputBox("Enter Date")
ActiveSheet.Name = MonthName(Month(dt))
End Sub

--


Gary


"RobcPettit" wrote in message
...
Hi, using an input box in vba, were a date ia added, I want to name
worksheets based on the month of the given date. For example if
21/6/08 was entered, then my worksheet will be called June. How do I
get the information using vba.
Regards Robert





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default month name

On 22 Jun, 23:25, "Gary Keramidas" <GKeramidasATmsn.com wrote:
here's one way:

Sub test()
Dim dt As Date
dt = InputBox("Enter Date")
Worksheets("sheet1").Name = MonthName(Month(dt))
End Sub

or

Sub test()
Dim dt As Date
dt = InputBox("Enter Date")
ActiveSheet.Name = MonthName(Month(dt))
End Sub

--

Gary

"RobcPettit" wrote in message

...



Hi, using an input box in vba, were a date ia added, I want to name
worksheets based on the month of the given date. For example if
21/6/08 was entered, then my worksheet will be called June. How do I
get the information using vba.
Regards Robert- Hide quoted text -


- Show quoted text -


Thanks everybody, thats helped me get the results I was looking for.
Regards Robert
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
excel to make the days cary over month to month automaticly GARY New Users to Excel 1 April 19th 08 06:05 PM
Excel 2003 month to month data change grid Chad[_2_] Excel Discussion (Misc queries) 2 February 15th 08 01:36 AM
When using MONTH function on Blank Cell!! Returns Month=Jan! mahou Excel Discussion (Misc queries) 6 January 9th 06 02:46 AM
copy worksheet from previous month and rename to current month Dan E. Excel Programming 4 December 8th 05 09:40 PM
transfer cell $ amount to other sheet month-to-month without overc Colin2u Excel Discussion (Misc queries) 1 July 28th 05 02:36 AM


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

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

About Us

"It's about Microsoft Excel"