Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi, I wonder if any one can help, I have a grid of dates between Y4 and
AD19 (in a spread sheet) what I would like to do is make 12 columns headed Jan Dec and find all dates that are January from the grid and place them in the column headed Jan, so if the date is in row 4 in the grid it would go in row 4 in the column headed Jan and the same with the columns headed Feb. to Dec. I dont know if this is possible, it may be a fun challenge for some one. Thank you, Barry. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
This macro does the job, if Jan Dec columns are columns A:L:
Sub test() Dim datesrng As Range, dcell As Range Set datesrng = Range("Y4:AD19") Dim mcounter(12) For mc = 0 To 11 mcounter(mc) = 0 Next mc For Each dcell In datesrng destcol = Month(dcell.Value) mcounter(destcol - 1) = mcounter(destcol - 1) + 1 Cells(mcounter(destcol - 1), destcol).Value = dcell.Value Next dcell End Sub Except: if the date is in row 4 in the grid it would go in row 4 in the column headed Jan Where do you want to to place the next date in row 4 in the grid if it is also a Jan date? Regards, Stefi barry ezt Γ*rta: Hi, I wonder if any one can help, I have a grid of dates between Y4 and AD19 (in a spread sheet) what I would like to do is make 12 columns headed Jan Dec and find all dates that are January from the grid and place them in the column headed Jan, so if the date is in row 4 in the grid it would go in row 4 in the column headed Jan and the same with the columns headed Feb. to Dec. I dont know if this is possible, it may be a fun challenge for some one. Thank you, Barry. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
there should be only one Jan in each row , what i do is type a date into a
cell and it populates the grid in two monthly intervals so 12/1/09 would give me 12/3/09-12/5/09 and so on, I will give your macro a go . do I stick it in the VBA page ? Thank you for your help. Kindest Regards,Barry. "barry" wrote: Hi, I wonder if any one can help, I have a grid of dates between Y4 and AD19 (in a spread sheet) what I would like to do is make 12 columns headed Jan Dec and find all dates that are January from the grid and place them in the column headed Jan, so if the date is in row 4 in the grid it would go in row 4 in the column headed Jan and the same with the columns headed Feb. to Dec. I dont know if this is possible, it may be a fun challenge for some one. Thank you, Barry. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
If you want to place a date always in the same row then use this version:
Sub test2() Dim datesrng As Range, dcell As Range Set datesrng = Range("Y4:AD19") For Each dcell In datesrng destcol = Month(dcell.Value) Cells(dcell.Row, destcol).Value = dcell.Value Next dcell End Sub To install it: Open VBA right click your workbook name in the Project explorer window InsertModule Copy macro in the code window Regards, Stefi barry ezt Γ*rta: there should be only one Jan in each row , what i do is type a date into a cell and it populates the grid in two monthly intervals so 12/1/09 would give me 12/3/09-12/5/09 and so on, I will give your macro a go . do I stick it in the VBA page ? Thank you for your help. Kindest Regards,Barry. "barry" wrote: Hi, I wonder if any one can help, I have a grid of dates between Y4 and AD19 (in a spread sheet) what I would like to do is make 12 columns headed Jan Dec and find all dates that are January from the grid and place them in the column headed Jan, so if the date is in row 4 in the grid it would go in row 4 in the column headed Jan and the same with the columns headed Feb. to Dec. I dont know if this is possible, it may be a fun challenge for some one. Thank you, Barry. |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
cheers
"barry" wrote: Hi, I wonder if any one can help, I have a grid of dates between Y4 and AD19 (in a spread sheet) what I would like to do is make 12 columns headed Jan Dec and find all dates that are January from the grid and place them in the column headed Jan, so if the date is in row 4 in the grid it would go in row 4 in the column headed Jan and the same with the columns headed Feb. to Dec. I dont know if this is possible, it may be a fun challenge for some one. Thank you, Barry. |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You are welcome! Thanks for the feedback!
Stefi barry ezt Γ*rta: cheers "barry" wrote: Hi, I wonder if any one can help, I have a grid of dates between Y4 and AD19 (in a spread sheet) what I would like to do is make 12 columns headed Jan Dec and find all dates that are January from the grid and place them in the column headed Jan, so if the date is in row 4 in the grid it would go in row 4 in the column headed Jan and the same with the columns headed Feb. to Dec. I dont know if this is possible, it may be a fun challenge for some one. Thank you, Barry. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
SORTING CELLS | Excel Worksheet Functions | |||
Sorting Cells | Excel Worksheet Functions | |||
Sorting cells: a list behind the cells do not move with the cell | Excel Discussion (Misc queries) | |||
sorting cells according to all cells in column A | Excel Worksheet Functions | |||
Sorting a range of cells that get value from other cells | Excel Discussion (Misc queries) |