ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro for multiple tasks (https://www.excelbanter.com/excel-programming/421482-macro-multiple-tasks.html)

Gemz

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.


Gary''s Student

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.


Gemz

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.


Mike Fogleman[_2_]

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.




Gary''s Student

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

Gemz

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.






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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com