Hello. I have in tab 1 a list of months going down column A. They are formatted Jan-12, Feb-12 etc. I would like a macro that creates a tab for each of these months but in the format Jan 2012, Feb 2012, etc. Help would be appreciated
Hello. I have in tab 1 a list of months going down column A. They are formatted Jan-12, Feb-12 etc. I would like a macro that creates a tab for each of these months but in the format Jan 2012, Feb 2012, etc. Help would be appreciated
Maybe:
Please Login or Register to view this content.
Hello ammartino44,
This should do what you want...
Please Login or Register to view this content.
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Star below the post.3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Sweet. This worked. Could you explain what each piece of the vba code is doing (I like to understand and learn)? Also, what if I wanted the order to be from oldest date tab on the left to newest date tab on the right? Thanks.
ammartino44:
Per your PM
I used three variables:
i - is used to increment operations from the bottom row of Column A to 2 (there is Step -1) which tells it too increment one step at a time upwards. (ie For i = Range("A" & Rows.Count).End(3)(1).Row To 2 Step -1)Please Login or Register to view this content.
x - is used to define each incremented value in Column A as a date. This is also used to change the formats to your required date for the added sheets name. (ie x = Range("A" & i).Value
Sheets.Add.Name = Format(x, "mmm yyyy")
ws - is used to identify the activesheet (ie Set ws = ActiveSheet)
ws.Activate - reactivates the activesheet (sheet with the dates)
Next i - increments to the next row.
Hope that helps.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks