Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help correct this macro! :)


Please help correct the following macro. The macro is not currently
reliable. I need this macro to always enter the hours in column A,
minutes in column B and seconds in column C. I need the macro to enter
this information in the lowest numbered row that has no information in
columns A, B and C.

The problem is that the current macro places the information in
different columns and rows each time (it is not repeatable). Any help
with fixing this macro would be greatly appreciated!


Thanks,

Mark


The macro is below:


Sub Macro1()
' Enter_Time_for_Qual_Log Macro
'
' This macro enters the Hours, Minutes & Seconds of
' the current time into the lower left empty cells.
'

ActiveCell.SpecialCells(xlLastCell).Select
SendKeys ("^{LEFT}"), True
SendKeys ("^{UP}"), True
ActiveCell.Offset(1, 0).Range("A1").Select

' SendKeys ("{DOWN}"), True
ActiveCell.FormulaR1C1 = "=HOUR(NOW())"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=MINUTE(NOW())"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=SECOND(NOW())"
ActiveCell.Offset(0, -2).Range("A1:C1").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMod
End Sub


--
ninpo1
------------------------------------------------------------------------
ninpo1's Profile: http://www.excelforum.com/member.php...o&userid=37239
View this thread: http://www.excelforum.com/showthread...hreadid=569563

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default Please help correct this macro! :)

Try this:

Sub AAAAA()
' Enter_Time_for_Qual_Log Macro
'
' This macro enters the Hours, Minutes & Seconds of
' the current time into the lower left empty cells.
'
Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Value = Hour(Now)
Range("B" & Rows.Count).End(xlUp).Offset(1, 0).Value = Minute(Now)
Range("C" & Rows.Count).End(xlUp).Offset(1, 0).Value = Second(Now)
End Sub

Hope this helps,

Hutch

"ninpo1" wrote:


Please help correct the following macro. The macro is not currently
reliable. I need this macro to always enter the hours in column A,
minutes in column B and seconds in column C. I need the macro to enter
this information in the lowest numbered row that has no information in
columns A, B and C.

The problem is that the current macro places the information in
different columns and rows each time (it is not repeatable). Any help
with fixing this macro would be greatly appreciated!


Thanks,

Mark


The macro is below:


Sub Macro1()
' Enter_Time_for_Qual_Log Macro
'
' This macro enters the Hours, Minutes & Seconds of
' the current time into the lower left empty cells.
'

ActiveCell.SpecialCells(xlLastCell).Select
SendKeys ("^{LEFT}"), True
SendKeys ("^{UP}"), True
ActiveCell.Offset(1, 0).Range("A1").Select

' SendKeys ("{DOWN}"), True
ActiveCell.FormulaR1C1 = "=HOUR(NOW())"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=MINUTE(NOW())"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=SECOND(NOW())"
ActiveCell.Offset(0, -2).Range("A1:C1").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMod
End Sub


--
ninpo1
------------------------------------------------------------------------
ninpo1's Profile: http://www.excelforum.com/member.php...o&userid=37239
View this thread: http://www.excelforum.com/showthread...hreadid=569563


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help correct this macro! :)


Tom,

Thanks for your help! I am not a macro wiz... It works flawlessly!


Mar

--
ninpo
-----------------------------------------------------------------------
ninpo1's Profile: http://www.excelforum.com/member.php...fo&userid=3723
View this thread: http://www.excelforum.com/showthread.php?threadid=56956

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Correct Macro for Totals franklin via OfficeKB.com Excel Discussion (Misc queries) 2 November 28th 08 04:00 PM
Correct syntax for IF, Then in a macro Ken[_2_] Excel Worksheet Functions 5 June 21st 08 06:19 PM
macro performing action if data is correct XCESIV[_5_] Excel Programming 0 May 2nd 06 11:20 PM
Please correct my macro famdamly Excel Discussion (Misc queries) 5 March 5th 06 08:45 PM
this Macro is don't correct MS[_6_] Excel Programming 2 January 26th 06 07:28 AM


All times are GMT +1. The time now is 03:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"