Help in Keeping Cell at Active Cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have recorded a macro where in a time is entered in a cell.
After entering the time the cursor gets back to cell D2.......I want after
entering the time cursor should be at the same cell where time is entered.
I have attached the text of recorded macro below........please suggest me
the change that is required do get the result.

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 2/1/2006 by Dhami'
' Keyboard Shortcut: Ctrl+q

ActiveCell.FormulaR1C1 = "=NOW()"
Range("C:D").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("D2").Select
Application.CutCopyMode = False
End Sub
 
Hi,

Try This:

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 2/1/2006 by Dhami'
' Keyboard Shortcut: Ctrl+q

Dim rngActive As Range

Set rngActive = ActiveCell

ActiveCell.FormulaR1C1 = "=NOW()"
Range("C:D").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False

rngActive.Select

Application.CutCopyMode = False
End Sub

Hoop this helps,


Executor
 
Try this:
Sub Test()
Range("A1").Activate
ActiveCell.Value = Date
Range("C:D").Value = Range("C:D").Value
End Sub

Just change A1 to whatever cell you want it to stay at, and put the date in.

Mike F
 
Back
Top