PDA

View Full Version : Solved: How to activate the cells by using VBA



clif
08-12-2012, 06:14 AM
How to activate the cells in Column B by using VBA! :banghead:

I need to press enter in each cells in column A so that the Monday, Tuesday ,... will shown be in column B. I attached the files to you. Please help me!

patel
08-12-2012, 07:14 AM
put in B3
=DAY(A3)

Bob Phillips
08-12-2012, 07:18 AM
Try using

=TEXT(A2,"dddd")

clif
08-12-2012, 07:55 AM
Both methods are useful but i still want to use the method like pressing the "enter" in column A to activate the formula for later development. Any Vba code to do that? Thanks!

patel
08-12-2012, 10:02 AM
can you explain why ?

Bob Phillips
08-12-2012, 10:59 AM
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 Then

If IsDate(Target.Value) Then

Target.Offset(0, 1).Value = Format(Target.Value, "dddd")
End If
End If
End Sub

clif
08-23-2012, 04:57 AM
I use data for pivot table and need the sort by date!
But the data is shown as 1/1/2012. 12/1/2012. 13/1/2012

What I want is 1/1/2012. 2/1/2012 3/1/2012

What should I do ? Thank you. Urgent!

Bob Phillips
08-23-2012, 06:15 AM
What sort, I don't recall that being mentioned earlier. And if so urgent, how come it took you 11 days to respond?

clif
08-25-2012, 11:15 PM
I know how to solve it,thank you!👍
It just enter 1 into one cell and then copy.then paste as value and by product in column of date.