PC Review


Reply
Thread Tools Rate Thread

Consolidate/ Clean-Up Some Code

 
 
Exceller
Guest
Posts: n/a
 
      8th Dec 2008
How do I consolidate this? Thanks.

.Offset(1, 0).Value = "January"
.Offset(1, 1).Value = "February"
.Offset(1, 2).Value = "March"
.Offset(1, 3).Value = "April"
.Offset(1, 4).Value = "May"
.Offset(1, 5).Value = "June"
.Offset(1, 6).Value = "July"
.Offset(1, 7).Value = "August"
.Offset(1, 8).Value = "September"
.Offset(1, 9).Value = "October"
.Offset(1, 10).Value = "November"
.Offset(1, 11).Value = "December"

 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      8th Dec 2008
Try something like

Dim N As Long
For N = 0 To 11
Range("A1").Offset(1, N).Value = _
Format(DateSerial(2000, N + 1, 1), "mmmm")
Next N


Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Sun, 7 Dec 2008 17:26:03 -0800, Exceller
<(E-Mail Removed)> wrote:

> How do I consolidate this? Thanks.
>
> .Offset(1, 0).Value = "January"
> .Offset(1, 1).Value = "February"
> .Offset(1, 2).Value = "March"
> .Offset(1, 3).Value = "April"
> .Offset(1, 4).Value = "May"
> .Offset(1, 5).Value = "June"
> .Offset(1, 6).Value = "July"
> .Offset(1, 7).Value = "August"
> .Offset(1, 8).Value = "September"
> .Offset(1, 9).Value = "October"
> .Offset(1, 10).Value = "November"
> .Offset(1, 11).Value = "December"

 
Reply With Quote
 
Exceller
Guest
Posts: n/a
 
      9th Dec 2008

Thanks, Chip. I appreciate your help.


"Chip Pearson" wrote:

> Try something like
>
> Dim N As Long
> For N = 0 To 11
> Range("A1").Offset(1, N).Value = _
> Format(DateSerial(2000, N + 1, 1), "mmmm")
> Next N
>
>
> Cordially,
> Chip Pearson
> Microsoft MVP
> Excel Product Group
> Pearson Software Consulting, LLC
> www.cpearson.com
> (email on web site)
>
>
> On Sun, 7 Dec 2008 17:26:03 -0800, Exceller
> <(E-Mail Removed)> wrote:
>
> > How do I consolidate this? Thanks.
> >
> > .Offset(1, 0).Value = "January"
> > .Offset(1, 1).Value = "February"
> > .Offset(1, 2).Value = "March"
> > .Offset(1, 3).Value = "April"
> > .Offset(1, 4).Value = "May"
> > .Offset(1, 5).Value = "June"
> > .Offset(1, 6).Value = "July"
> > .Offset(1, 7).Value = "August"
> > .Offset(1, 8).Value = "September"
> > .Offset(1, 9).Value = "October"
> > .Offset(1, 10).Value = "November"
> > .Offset(1, 11).Value = "December"

>

 
Reply With Quote
 
Dana DeLouis
Guest
Posts: n/a
 
      10th Dec 2008
Just another...

Sub Demo()
ActiveCell.Resize(1, 12) = Application.GetCustomListContents(4)
End Sub

= = =
HTH :>)
Dana DeLouis


Exceller wrote:
> Thanks, Chip. I appreciate your help.
>
>
> "Chip Pearson" wrote:
>
>> Try something like
>>
>> Dim N As Long
>> For N = 0 To 11
>> Range("A1").Offset(1, N).Value = _
>> Format(DateSerial(2000, N + 1, 1), "mmmm")
>> Next N
>>
>>
>> Cordially,
>> Chip Pearson
>> Microsoft MVP
>> Excel Product Group
>> Pearson Software Consulting, LLC
>> www.cpearson.com
>> (email on web site)
>>
>>
>> On Sun, 7 Dec 2008 17:26:03 -0800, Exceller
>> <(E-Mail Removed)> wrote:
>>
>>> How do I consolidate this? Thanks.
>>>
>>> .Offset(1, 0).Value = "January"
>>> .Offset(1, 1).Value = "February"
>>> .Offset(1, 2).Value = "March"
>>> .Offset(1, 3).Value = "April"
>>> .Offset(1, 4).Value = "May"
>>> .Offset(1, 5).Value = "June"
>>> .Offset(1, 6).Value = "July"
>>> .Offset(1, 7).Value = "August"
>>> .Offset(1, 8).Value = "September"
>>> .Offset(1, 9).Value = "October"
>>> .Offset(1, 10).Value = "November"
>>> .Offset(1, 11).Value = "December"

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Consolidate Code Dan Microsoft Access 1 23rd Mar 2010 07:00 AM
Modification to code to consolidate two sheets... Darin Kramer Microsoft Excel Programming 5 22nd Aug 2006 06:35 AM
Modifying code to Consolidate only 1 column.. Darin Kramer Microsoft Excel Programming 3 21st Aug 2006 04:47 PM
Consolidate - edit code? Steph Microsoft Excel Programming 1 3rd Mar 2006 12:05 AM
Clean Up Code - consolidate steps =?Utf-8?B?RnJhbnRpYyBFeGNlbC1lcg==?= Microsoft Excel Misc 6 30th Jun 2005 03:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:35 AM.