![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 11:18 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com