Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If/Then/Else formulas in macros


I am new to VB/macros but want to know if this is possible. I have
created a workbook to quickly and easily record times for runners. I
have assigned a macro to a button titled "start" which inserts the
current time in cell A1. Then I have created several numbered buttons
that put the current time next to a runners name. A formula subtracts
the difference to get the time.

What I now want to do is be able to get a split time by pressing the
button for a second time. What I need the macro to do is on the first
press of a button put the current time in cell A3, on the second press
of the same button place the current time in cell B3, and on the third
press of the same button place the current time in cell C3. Is this
possible and how, or is there a better way to accomplish this?

Here is the current macro I recorded.

Sub Finish_01()
'
' Finish_01 Macro
' Macro recorded 10/11/2005 by CJ_22
'

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

Thanks for any reply.


--
CJ-22
------------------------------------------------------------------------
CJ-22's Profile: http://www.excelforum.com/member.php...o&userid=17551
View this thread: http://www.excelforum.com/showthread...hreadid=503191

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default If/Then/Else formulas in macros

Hi there,

If you do not have anything else in row 3, you could use something like this
....

Sub try_this()
Cells(3, columns.count).end(xltoleft).offset(0, 1).value = time
End sub

Format row 3 as desired.

HTH

--
Regards,
Zack Barresse, aka firefytr


"CJ-22" wrote in
message ...

I am new to VB/macros but want to know if this is possible. I have
created a workbook to quickly and easily record times for runners. I
have assigned a macro to a button titled "start" which inserts the
current time in cell A1. Then I have created several numbered buttons
that put the current time next to a runners name. A formula subtracts
the difference to get the time.

What I now want to do is be able to get a split time by pressing the
button for a second time. What I need the macro to do is on the first
press of a button put the current time in cell A3, on the second press
of the same button place the current time in cell B3, and on the third
press of the same button place the current time in cell C3. Is this
possible and how, or is there a better way to accomplish this?

Here is the current macro I recorded.

Sub Finish_01()
'
' Finish_01 Macro
' Macro recorded 10/11/2005 by CJ_22
'

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

Thanks for any reply.


--
CJ-22
------------------------------------------------------------------------
CJ-22's Profile:
http://www.excelforum.com/member.php...o&userid=17551
View this thread: http://www.excelforum.com/showthread...hreadid=503191



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
Macros and Formulas Daniel Excel Worksheet Functions 4 August 14th 08 08:35 PM
using formulas in macros BBEXCELNOVICE Excel Discussion (Misc queries) 4 November 12th 06 10:03 AM
formulas vs macros excelFan Excel Discussion (Misc queries) 4 March 23rd 06 01:45 PM
Macros within formulas praveen_khm[_5_] Excel Programming 3 January 16th 06 02:18 PM
formulas to macros raja Excel Programming 0 September 21st 05 02:01 PM


All times are GMT +1. The time now is 08:58 AM.

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"