Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro for multiple tasks
I have a series of steps i need to code for a macro and dont even know how
to start! Can anyone help please? 1- To the right hand side of column G (i.e. column H) take the date from column G which is in dd/mm/yyy y format and change to ddd format putting this into column H (this should be applied to the whole column, at the moment the column is 400 lines long but this can grow so its best not to specify). 2- Once the above is done, the whole sheet should be sorted by column H (this is the ddd format cells) 3- The days of the week should be counted in some way and then the day that appears most should be highlighted (if i could get a table of results somewhere then that would be brilliant!) 4- Msg box to appear telling user which day of the week is most popular.. Appreciate your help. Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro for multiple tasks
Here are the first two parts:
Sub genz() Set ra = ActiveSheet.UsedRange Set g = Range("G:G") Set r = Intersect(ra, g) For Each rr In r If IsDate(rr) Then rr.Offset(0, 1).Value = Format(rr.Value, "ddd") End If Next Cells.Select Selection.Sort Key1:=Range("H1"), Order1:=xlAscending, Header:=xlNo End Sub -- Gary''s Student - gsnu200820 "Gemz" wrote: I have a series of steps i need to code for a macro and dont even know how to start! Can anyone help please? 1- To the right hand side of column G (i.e. column H) take the date from column G which is in dd/mm/yyy y format and change to ddd format putting this into column H (this should be applied to the whole column, at the moment the column is 400 lines long but this can grow so its best not to specify). 2- Once the above is done, the whole sheet should be sorted by column H (this is the ddd format cells) 3- The days of the week should be counted in some way and then the day that appears most should be highlighted (if i could get a table of results somewhere then that would be brilliant!) 4- Msg box to appear telling user which day of the week is most popular.. Appreciate your help. Thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro for multiple tasks
Hi,
Thanks for quick response, i tried the macro and it didnt work as required becaues of some details i left out in the previous message! To begin with column H is already populated, i should have said i need column H (including its heading cell) moving into column I and then i want the ddd format entered into column H..also it needs a new header cell called 'day of week'.. thanks.. "Gary''s Student" wrote: Here are the first two parts: Sub genz() Set ra = ActiveSheet.UsedRange Set g = Range("G:G") Set r = Intersect(ra, g) For Each rr In r If IsDate(rr) Then rr.Offset(0, 1).Value = Format(rr.Value, "ddd") End If Next Cells.Select Selection.Sort Key1:=Range("H1"), Order1:=xlAscending, Header:=xlNo End Sub -- Gary''s Student - gsnu200820 "Gemz" wrote: I have a series of steps i need to code for a macro and dont even know how to start! Can anyone help please? 1- To the right hand side of column G (i.e. column H) take the date from column G which is in dd/mm/yyy y format and change to ddd format putting this into column H (this should be applied to the whole column, at the moment the column is 400 lines long but this can grow so its best not to specify). 2- Once the above is done, the whole sheet should be sorted by column H (this is the ddd format cells) 3- The days of the week should be counted in some way and then the day that appears most should be highlighted (if i could get a table of results somewhere then that would be brilliant!) 4- Msg box to appear telling user which day of the week is most popular.. Appreciate your help. Thanks. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro for multiple tasks
Add this to the start of the macro:
Columns("I:I").Insert Cells(1, 9).Value = "Day of Week" Columns("I:I").AutoFit Mike F "Gemz" wrote in message ... Hi, Thanks for quick response, i tried the macro and it didnt work as required becaues of some details i left out in the previous message! To begin with column H is already populated, i should have said i need column H (including its heading cell) moving into column I and then i want the ddd format entered into column H..also it needs a new header cell called 'day of week'.. thanks.. "Gary''s Student" wrote: Here are the first two parts: Sub genz() Set ra = ActiveSheet.UsedRange Set g = Range("G:G") Set r = Intersect(ra, g) For Each rr In r If IsDate(rr) Then rr.Offset(0, 1).Value = Format(rr.Value, "ddd") End If Next Cells.Select Selection.Sort Key1:=Range("H1"), Order1:=xlAscending, Header:=xlNo End Sub -- Gary''s Student - gsnu200820 "Gemz" wrote: I have a series of steps i need to code for a macro and don't even know how to start! Can anyone help please? 1- To the right hand side of column G (i.e. column H) take the date from column G which is in dd/mm/yyy y format and change to ddd format - putting this into column H (this should be applied to the whole column, at the moment the column is 400 lines long but this can grow so its best not to specify). 2- Once the above is done, the whole sheet should be sorted by column H (this is the ddd format cells) 3- The days of the week should be counted in some way and then the day that appears most should be highlighted (if i could get a table of results somewhere then that would be brilliant!) 4- Msg box to appear telling user which day of the week is most popular.. Appreciate your help. Thanks. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro for multiple tasks
You will clearly need to make adaptations of the code I posted to suit your
specific needs. I can't see the complete structure of your worksheet, so I post demo code. Even this demo code is incomplete. -- Gary''s Student - gsnu200820 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro for multiple tasks
Hi Mike,
I tried the addition you suggested but i get 'error 400'. any ideas why this may be? thanks "Mike Fogleman" wrote: Add this to the start of the macro: Columns("I:I").Insert Cells(1, 9).Value = "Day of Week" Columns("I:I").AutoFit Mike F "Gemz" wrote in message ... Hi, Thanks for quick response, i tried the macro and it didnt work as required becaues of some details i left out in the previous message! To begin with column H is already populated, i should have said i need column H (including its heading cell) moving into column I and then i want the ddd format entered into column H..also it needs a new header cell called 'day of week'.. thanks.. "Gary''s Student" wrote: Here are the first two parts: Sub genz() Set ra = ActiveSheet.UsedRange Set g = Range("G:G") Set r = Intersect(ra, g) For Each rr In r If IsDate(rr) Then rr.Offset(0, 1).Value = Format(rr.Value, "ddd") End If Next Cells.Select Selection.Sort Key1:=Range("H1"), Order1:=xlAscending, Header:=xlNo End Sub -- Gary''s Student - gsnu200820 "Gemz" wrote: I have a series of steps i need to code for a macro and don't even know how to start! Can anyone help please? 1- To the right hand side of column G (i.e. column H) take the date from column G which is in dd/mm/yyy y format and change to ddd format - putting this into column H (this should be applied to the whole column, at the moment the column is 400 lines long but this can grow so its best not to specify). 2- Once the above is done, the whole sheet should be sorted by column H (this is the ddd format cells) 3- The days of the week should be counted in some way and then the day that appears most should be highlighted (if i could get a table of results somewhere then that would be brilliant!) 4- Msg box to appear telling user which day of the week is most popular.. Appreciate your help. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to open multiple excel files as separate tasks on the taskbar? | Setting up and Configuration of Excel | |||
What's An Easy Way To Establish Predecessor/Follower Relationship in Multiple Tasks At Once? | Charts and Charting in Excel | |||
sending outlook tasks to multiple people | Excel Programming | |||
Macro -- repetitive tasks | Excel Discussion (Misc queries) | |||
Using macro to run repetitive tasks | Excel Discussion (Misc queries) |