Mehmud Khan
Member
Dear Ninjas and Excel Gurus,
Good day!
Need help in excel VBA script.
I know its bit difficult for me to crack but for Ninja's its like soooooop task....
I have created a VBA wherein user can select any cell and click on button to get time stamp on selected cell.
>>> use code - tags <<<
But I trying to make a change but unfortunately I failed in many attempts.
I want the above VBA should work only specific range("A5:A10") and range("B5:B10").
For more clarification, if user select cell A6 and hit on time-stamp button then user must get time get [which is working fine], but when user click on cell A11 or B15 then above VBA should not work and user get msg prompt "You are trying to stamp in wrong cell".
I hope I tried my best to explain the scenario.
If any one has any clue or suggestion then please help me out.
Thanks in advance.
regards,
Mehmud Khan
Good day!
Need help in excel VBA script.
I know its bit difficult for me to crack but for Ninja's its like soooooop task....
I have created a VBA wherein user can select any cell and click on button to get time stamp on selected cell.
>>> use code - tags <<<
Code:
Sub TimeStamp()
Application.ScreenUpdating = False
Dim AnswerYes As String
Dim AnswerNo As String
AnswerYes = MsgBox("Are you sure want to update the time in current cell?", vbQuestion + vbYesNo, "Attention!! This command can't be undo")
If AnswerYes = vbYes Then
ActiveCell.Select
ActiveCell.FormulaR1C1 = "=NOW()"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.NumberFormat = "[$-en-US]h:mm AM/PM;@"
If AnswerNo = vbNo Then Exit Sub
End If
End If
Application.ScreenUpdating = False
End Sub
But I trying to make a change but unfortunately I failed in many attempts.
I want the above VBA should work only specific range("A5:A10") and range("B5:B10").
For more clarification, if user select cell A6 and hit on time-stamp button then user must get time get [which is working fine], but when user click on cell A11 or B15 then above VBA should not work and user get msg prompt "You are trying to stamp in wrong cell".
I hope I tried my best to explain the scenario.
If any one has any clue or suggestion then please help me out.
Thanks in advance.
regards,
Mehmud Khan
Last edited by a moderator: