Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default Formatting Month display via macro

I have weveral worksheets that have the months listed across the top of the
table. The months are listed in a three letter format (ex. - Jan Feb Mar
etc.)
These columns shift each month. However, because some worksheets get
updated and others don't, one worksheet's columns may not get shifted when
others do.

If I type "Jan" in A1 and then fill to the right through "Dec", it fills
with 3-letter formats. However, when the first cell is "May", it fills
using the full month name. Is there a way to reformat these cells to the
3-letter format of the month name? I'm doing all of this (copying,
pasting/fill right) via a macro.

I'm using the following code where Q1 = the month name in a 3-letter format

Range("B25").Select
Selection.Value = Sheets("Data").Range("Q1").Value
Selection.AutoFill Destination:=Range("B25:M25"), Type:=xlFillDefault


Thanks in advance,
Paul


  #2   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Formatting Month display via macro

Instead of
Selection.Value = Sheets("Data").Range("Q1").Value


You may try
Selection.Value = format(Sheets("Data").Range("Q1").Value, "mmm")


Not tested.

"PCLIVE" wrote:

I have weveral worksheets that have the months listed across the top of the
table. The months are listed in a three letter format (ex. - Jan Feb Mar
etc.)
These columns shift each month. However, because some worksheets get
updated and others don't, one worksheet's columns may not get shifted when
others do.

If I type "Jan" in A1 and then fill to the right through "Dec", it fills
with 3-letter formats. However, when the first cell is "May", it fills
using the full month name. Is there a way to reformat these cells to the
3-letter format of the month name? I'm doing all of this (copying,
pasting/fill right) via a macro.

I'm using the following code where Q1 = the month name in a 3-letter format

Range("B25").Select
Selection.Value = Sheets("Data").Range("Q1").Value
Selection.AutoFill Destination:=Range("B25:M25"), Type:=xlFillDefault


Thanks in advance,
Paul



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Formatting Month display via macro

Hi Paul,

Try this

aryList = Application.GetCustomListContents(3)
iStart = Application.Match(Sheets("Data").Range("Q1").Value , aryList, 0)
With Sheets("Data").Range("B25")
.Value = aryList(iStart)
iSecond = iSecond + 1
If iSecond = 13 Then iSecond = 1
.Offset(0, 1).Value = aryList(iSecond)
.Resize(, 2).AutoFill Destination:=.Resize(, 12),
Type:=xlFillDefault
End With


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"PCLIVE" wrote in message
...
I have weveral worksheets that have the months listed across the top of

the
table. The months are listed in a three letter format (ex. - Jan Feb

Mar
etc.)
These columns shift each month. However, because some worksheets get
updated and others don't, one worksheet's columns may not get shifted when
others do.

If I type "Jan" in A1 and then fill to the right through "Dec", it fills
with 3-letter formats. However, when the first cell is "May", it fills
using the full month name. Is there a way to reformat these cells to the
3-letter format of the month name? I'm doing all of this (copying,
pasting/fill right) via a macro.

I'm using the following code where Q1 = the month name in a 3-letter

format

Range("B25").Select
Selection.Value = Sheets("Data").Range("Q1").Value
Selection.AutoFill Destination:=Range("B25:M25"), Type:=xlFillDefault


Thanks in advance,
Paul




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
display month only aditya Excel Discussion (Misc queries) 4 May 29th 09 08:16 AM
MONTH display andrew Excel Discussion (Misc queries) 6 July 11th 08 05:55 AM
Display each day of the month WH99 Excel Discussion (Misc queries) 4 June 22nd 08 10:07 PM
I want a the to display the Month name only. Nothing else. DAiuto Setting up and Configuration of Excel 3 September 27th 07 12:19 AM
Display every 3rd category name but still display latest month maryj Charts and Charting in Excel 1 September 24th 06 09:05 PM


All times are GMT +1. The time now is 11:48 PM.

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"