Possibly a VBA command needed

rupjon

New Member
Joined
Sep 2, 2014
Messages
4
Hello All!

I am trying to build a excel sheet that can do the following.
When some one selects a yes or no (from the list) in Column B it than copies the Cell E10 and pastes special text/value only into the corresponding row Cell E.

Eg click yes on B4 pastespecial the static date and time E4, click no B8 pastes static date time E8. (i dont want the times changing when any other cell changes (except for the E10 NOW() fuction)

B C D E
4 Yes/No static Date and time
5 Yes/No
6 Yes/No
7 Yes/No
8 Yes/No
9 Yes/No
10 =Now() (updating date and time)

Please i have been stuck here now for a while.

Any help would be appreciated.

Thank you!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
This works. You may need to play with the formatting to get the date/time the way you want it to look:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Cells(1, 2).Resize(ActiveSheet.UsedRange.Rows.Count)) Is Nothing Then
    If Target.Value = "Yes" Then Target.Offset(0, 3).Value = Format(Now(), "hh:mm DD/MM/YYYY")
End If
End Sub
Dan
 
Upvote 0
This works. You may need to play with the formatting to get the date/time the way you want it to look:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Cells(1, 2).Resize(ActiveSheet.UsedRange.Rows.Count)) Is Nothing Then
    If Target.Value = "Yes" Then Target.Offset(0, 3).Value = Format(Now(), "hh:mm DD/MM/YYYY")
End If
End Sub
Dan

Thank you Dan! it works well! Thanks again!
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top