ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   cursor keys in a macro (https://www.excelbanter.com/excel-programming/298265-cursor-keys-macro.html)

mark hansen

cursor keys in a macro
 
I recorded a macro and modified it and part of it works great, al
except for the last step. Here is what I'm trying to do.

I need to put the current time in a cell and a little while later pu
the time in the cell to the right. Kind of like a timer.

I recorded a macro that put the function Now() in the cell, then
copy to clipboard, then paste special (values) back in the same cell.
this puts the time back in the cell where its won't recalculate as th
function NOW(). I modified the macro to use the Active.cell whe
pasting so it won't jump to the cell I recorded macro with. that par
works great.

The problem is with the last step... After I paste the first time int
the cell, I want to move one cell to the right. the recorded macr
puts in the cell I use during recording... I need that to be relative
I need to modify to just cursor

I think I need the macro command to cursor once to the right.

the current macro is...

'

'
ActiveCell.FormulaR1C1 = "=NOW()"
ActiveCell.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
SkipBlanks _
:=False, Transpose:=False
End Sub

What do I add to just move to the right one column?

Thanks
Mar

--
Message posted from http://www.ExcelForum.com


Auric__

cursor keys in a macro
 
On Thu, 13 May 2004 17:57:28 -0500, mark hansen
wrote:

I recorded a macro and modified it and part of it works great, all
except for the last step. Here is what I'm trying to do.

I need to put the current time in a cell and a little while later put
the time in the cell to the right. Kind of like a timer.

I recorded a macro that put the function Now() in the cell, then I
copy to clipboard, then paste special (values) back in the same cell.
this puts the time back in the cell where its won't recalculate as the
function NOW(). I modified the macro to use the Active.cell when
pasting so it won't jump to the cell I recorded macro with. that part
works great.

The problem is with the last step... After I paste the first time into
the cell, I want to move one cell to the right. the recorded macro
puts in the cell I use during recording... I need that to be relative.
I need to modify to just cursor

I think I need the macro command to cursor once to the right.

the current macro is...

'

'
ActiveCell.FormulaR1C1 = "=NOW()"
ActiveCell.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False


This is crap. Replace all of the above code with this line:
ActiveCell.Formula = Time

End Sub

What do I add to just move to the right one column?


This moves 0 cells down and 1 cell to the right.
ActiveCell.Offset(0,1).Select
--
auric underscore underscore at hotmail dot com
*****
Face down, arms out
Nailed to the cross of doubt
Blood runs like rain
Drowning for this world in vain
Crown of black thorns
Human skin, ripped and torn
Where is your savior now?
Where is your savior now?
-- Fear Factory, "****christ"

mark hansen[_2_]

cursor keys in a macro
 
Thanks for your help and quick responce... I appreciate it...

The original macro was recorded... That why all the extra stuff.
thanks for help with that too

--
Message posted from http://www.ExcelForum.com


[email protected]

cursor keys in a macro
 
Activecell.Value=Now
Activecell.Offset(0,1).Select

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------

ActiveCell.FormulaR1C1 = "=NOW()"
ActiveCell.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

What do I add to just move to the right one column?

Thanks
Mark



mark hansen[_3_]

cursor keys in a macro
 
Thanks for the help... boy, it sure can get alot cleaner..

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 10:04 PM.

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