Excel Vba- Userform stopwatch

Hi People,

I am currently trying to code s stopwatch function.

At present the function i have created has two command buttons, on
start and one stop which gives the date and time from clicking eac
button (one in a1 the other b1)

What i want it to do is not overwrite the information each time bu
just go to the next line, how do i do that?

Cheers

Steve

Code currently is 

Private Sub CommandButton1_Click()
Range("A1").Value = Date
Range("A2").Value = Time
End Sub

Private Sub CommandButton2_Click()
Range("b1").Value = Date
Range("b2").Value = Time
End Su

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

0
5/26/2004 12:59:13 PM
excel.misc 78881 articles. 5 followers. Follow

4 Replies
773 Views

Similar Articles

[PageSpeed] 6

Steve,

Try something like

Dim Rng As Range
Set Rng = Cells(Rows.Count,"A").End(xlUp)(2,1)
Rng(1,1).Value = Date
Rng(2,1).Value = Time


-- 
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"stevieh >" <<stevieh.16v6gn@excelforum-nospam.com> wrote in
message news:stevieh.16v6gn@excelforum-nospam.com...
> Hi People,
>
> I am currently trying to code s stopwatch function.
>
> At present the function i have created has two command buttons,
one
> start and one stop which gives the date and time from clicking
each
> button (one in a1 the other b1)
>
> What i want it to do is not overwrite the information each time
but
> just go to the next line, how do i do that?
>
> Cheers
>
> Steve
>
> Code currently is
>
> Private Sub CommandButton1_Click()
> Range("A1").Value = Date
> Range("A2").Value = Time
> End Sub
>
> Private Sub CommandButton2_Click()
> Range("b1").Value = Date
> Range("b2").Value = Time
> End Sub
>
>
> ---
> Message posted from http://www.ExcelForum.com/
>


0
chip1 (1821)
5/26/2004 1:05:53 PM
hi,

how can i make it so that a1 is never older than b1. i.e

a1=1  b1=2  correct

a1=2    b1=1 incorrect

basically to stop someone clicking stop before star

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

0
5/26/2004 1:46:00 PM
hi,

how can i make it so that a1 is never older than b1. i.e

a1=1  b1=2  correct

a1=2    b1=1 incorrect

basically to stop someone clicking stop before start

cheers

stev

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

0
5/26/2004 1:46:34 PM
Maybe you could stop them from clicking the buttons out of order.

I put 3 buttons on a userform--btnStart, btnStop, btnCancel.

Then I tried this:

Option Explicit
Private Sub btnCancel_Click()
    Unload Me
End Sub
Private Sub btnStart_Click()
    Call UpdateButtons
End Sub
Private Sub btnStop_Click()
    Call UpdateButtons
End Sub
Private Sub UserForm_Initialize()
    Me.btnStop.Enabled = False
End Sub
Private Sub UpdateButtons()

    Dim rng As Range
    
    With Worksheets("sheet1")
        Set rng = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
    End With
    
    rng.Value = Date
    rng.Offset(0, 1).Value = Time
    If Me.btnStart.Enabled Then
        rng.Offset(0, 2).Value = "Start"
    Else
        rng.Offset(0, 2).Value = "Stop"
    End If
    
    Me.btnStart.Enabled = (Not Me.btnStart.Enabled)
    Me.btnStop.Enabled = (Not Me.btnStop.Enabled)
    Me.btnCancel.Enabled = (Not Me.btnCancel.Enabled)
    
End Sub

"stevieh <" wrote:
> 
> hi,
> 
> how can i make it so that a1 is never older than b1. i.e
> 
> a1=1  b1=2  correct
> 
> a1=2    b1=1 incorrect
> 
> basically to stop someone clicking stop before start
> 
> ---
> Message posted from http://www.ExcelForum.com/

-- 

Dave Peterson
ec35720@msn.com
0
ec35720 (10082)
5/27/2004 12:19:10 AM
Reply:

Similar Artilces:

Excel Adding years or months to a date
I want to be able to add months or years to a date. For example 25/4/05 + 9 months 25/4/05 + 15 years. I am using Excel 2000. The standard way is: =DATE(YEAR(A1),MONTH(A1)+9,DAY(A1)) to add 9 months. For 15 years try: =DATE(YEAR(A1)+15,MONTH(A1),DAY(A1)) HTH Jason Atlanta, GA "Joan" wrote: > I want to be able to add months or years to a date. > > For example 25/4/05 + 9 months > 25/4/05 + 15 years. > > I am using Excel 2000. On Mon, 25 Apr 2005 06:54:03 -0700, "Joan" <Joan@discussions.microsoft.com> wrote: >I want to be able to a...

Excel working in with Outlook
I have Office 2007 so obviously Outlook 2007 and Excel 2007. I have made up a newbie's Excel spreadsheet for my business. One thing to open that has my entire financial year's data in it and my car logbook. One thing I am going to add to it is parts. I want to know when parts need to be re-ordered so will set a level where I want Excel to show up basically something like a "reorder now" warning. However, I am often in a hurry, record the event and don't look at the outcome until I have some time, late at night. At that time, reordering becomes a nightmare. Is ther...

Dynamic List Box using VBA
I wasn't really sure how to phrase this one -- this isn't your Typical Drop-Down List. I have a SELECT statement which queries SQL Server 2005 and displays the data in Excel. Let's say that a database lists products that have been delivered to 4 different cities, on 3 seperate days -- without knowing (in advance) the delivery dates, how could I create an input/drop-down field to allow the user to specify a particular date? I envision something like this: VBA code produces a list box of delivery dates based on a particular product and city. The user selects a delivery date ...

excel export available
I have a query that I wish to export the results to Excel. However, the Excel button on the Export Data tab is grayed out? It used to work. Any ideas of what makes the Excel Export unavailable? Thanks, Mike ...

Creating an Excel table from Access
Hi, I have an Access database which I use to log downtime for systems. I have a requirement to produce a monthly report based on this data, however, this needs to be exported to excel in a specific format. Down the left side of the report need to go the names of the services, with the days (numerically like: 1, 2, 3 .. 29, 30 etc) across the top. Then I need to count the number of times each service was down on a give day, and insert that information into the necessary cell - so if intranet services had been down twice on 16th March, for example, there would be a 2 in column 16, whi...

Excel data disappeared after getting message about compatibility M
I tried to save changes to a spreadsheet, and received the following message: "Compatibility Report for New Customer List.xls Run on 4/6/2010 19:52 The following features in this workbook are not supported by earlier versions of Excel. These features may be lost or degraded when you save this workbook in an earlier file format. Minor loss of fidelity Some cells or styles in this workbook contain formatting that is not supported by the selected file format. These formats will be converted to the closest format available." I clicked OK, because fidelity is not imp...

Import contacts from Excel
I have numerous contact lists with various categories and wondered if i can import them into an email distribution list so that i do not need to hand type each email? thanks "angie" <angie@discussions.microsoft.com> wrote in message news:64042F86-62E0-4D42-B9CE-49C134DB4B7B@microsoft.com... >I have numerous contact lists with various categories and wondered if i can > import them into an email distribution list so that i do not need to hand > type each email? You can't import into a DL. Instead import into your Contacts and assign categories to ...

How to lock a line put on a graph in excell
I am trying to attach a line to a graph with months on the X axis. When I add additional months I want the line to stay in between the original months, however, it always moves as the graph expands. Drawing objects cannot be linked to specific values of chart axes, unless you incorporate them as series in the chart. Try the techniques here: http://peltiertech.com/Excel/Charts/AddLine.html - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "Dennis" <Dennis@discussions.microsoft.com> wrote in message news:336...

Excel is not counting
merry x'mas In excel 2003, i entered a number in a column and dragged down the rows to count the consecutive numbers automatically, but it was just copying the same number instead counting. How to change so as to count? -- Life isa journey not a destination Do the same while holding the CTRL Pressed. Micky "Sherees" wrote: > merry x'mas > In excel 2003, i entered a number in a column and dragged down the rows to > count the consecutive numbers automatically, but it was just copying the same > number instead counting. How to change so as to...

Random Sampling in Microsoft Excell 2002
Hi, I'm trying to create a random sample using the Data Analysis tool in Excell. The problem I'm having is that I can't figure out how to make a non-repeating sample. I want all the observations in the sample to be unique. How do I do this without manually deleting the repeat entries on the output worksheet? next to the entries, put in the formula =Rand() then drag fill down the column. Sort the data and this column with this column as the key. Then take the top "n" items. Regards, Tom Ogilvy "EJ Ford" <edseljoe@earthlink.net> wrote in mess...

Querying Excel data without another program
Hello, I'm an intermediate user of Excel, but I have lots of experience using Access. If you can give me clues on how to handle the information below using only Excel, I'd be grateful! I have a spreadsheet in Excel 97 in which there's a Worksheet named, "Datasource" with a column "B" containing repetitive data. I'd like to create a new worksheet in the same Excel file which shows a single instance of each item used in Column "B". If I were writing the query in SQL, I'd say "SELECT DISTINCT [Column B] FROM [MySpreadsheet]![Datasource...

Excel Formulae #2
Hi, I have a spreadsheet with value in one column & a series of dates in 5 other columns.For each row depending on the value in the first colunm a date may be applicable in one or more of the other columns.e.g 550 in the first column will mean dates will be inserted in the next 2 columns similar to authority levels. My qn. is how can I show what's outstanding if the relevant authority levels have not signed off-basically this is used as a tracker of invoices & I would like to show what is outstanding awaiting approval at anytime. Thanks Raj ----------------------------------...

Add a Word Document as a Tab in an Excel Document
I work on several documents that require both worksheets and written reports - being able to add a word document as a new tab in Excel would be a neat way of integrating the two into one file for storing/printing/emailing. Maybe... http://www.pcmag.com/article2/0,4149,5224,00.asp "Office Binder: Gone but Not Really" PC Magazine article, January 29, 2002 by M. David Stone on using Binder in Office XP Jim Cone San Francisco, USA "GoDamN" <GoDamN@discussions.microsoft.com> wrote in message news:5F814119-2FA1-4BA6-92EB-C524C8C3820C@microsoft.com... > I work on s...

Excel 2003 - VBA
Hi, What is a simple way to check to see if a sheet of a given name is present in a workbook? Thanks, Craig Dim Sht as object set sht = nothing on error resume next set sht = activeworkbook.sheets("somesheetnamehere") on error goto 0 if sht is nothing then msgbox "nope" else msgbox "yep" end if Craig Brandt wrote: > > Hi, > > What is a simple way to check to see if a sheet of a given name is present > in a workbook? > > Thanks, > Craig -- Dave Peterson Dave: Thanks for the quick response. Works like a champ, Craig &q...

running excel in background
I'd like to run a program that writes values from one cell to another with a VBA program that is triggered by the clock. I've completed this part but, since I use active cells, you can't run another workbook without the clock activating the cell in the active worksheet. It needs to run in the background all day long. - ideas? will it run in the background if I don't activate cells? Try launching another instance of Excel. -- Earl Kiosterud mvpearl omitthisword at verizon period net ------------------------------------------- "Don" <thedonallen@yahoo.com&g...

How do I export email addresses from excel to outlook?
I am trying to do a mail merge using email via outlook. I have 200+ addresses and I'd like to know how to import the addresses into the contacts section of outlook to do the merge from there. I've tried the help part of out look but it comes up saying that the excel file has no named ranges and that I should use excel to name the range of data to be imported. Any help much appreciated. Thanks Mark In outlook select file/import export/ import from another program or file/ and then follow the instructions from the wizard. Why do you want to do the mailmerge from Outlook? You can...

how do why update my Excel microsoft office
how do why update my Excel microsoft office If you have office 5, you probably would want to update -- Don Guillett SalesAid Software donaldb@281.com "sam" <sam@discussions.microsoft.com> wrote in message news:2D951DBF-43DE-4C65-8CAC-B4E73DC572FD@microsoft.com... > how do why update my Excel microsoft office ...

Email Help: Sending Outlook email from Excel VBA
Hi All, How do I select a specific property in outlook while sending email from excel? There is an option we can set in outlook outgoing emails call "Voting buttons" in that feature there is a custom option that we can select called "Have replies sent to" its a checkbox. I want it checked when i send an email from excel. Hope i made it clear. Thanks in advance If sending through the Outlook Object Model, use the MailItem.VotingOptions property and MailItem.ReplyRecipients collection. -- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSp...

No Smart Tag help: just a blank "MS Excel Help" window
When I invoke "help on this error" on a Smart Tag drop-down, a blank "MS Excel Help" window appears with no content. The general help pane that appears via <F1> etc. is fine - it's just the Smart Tag help option that doesn't show anything, just a blank window. Any suggestions? Win XP Home SP2 Excel 2003 (11.6355.6360) SP1 ...

VBA
Creating a sequencial membership number based on previous record using DMax. While the code works great, I need to protect the records with membership numbers already assigned in that the code is executed upon "Click". Tried criteria portion of DMAX but always returns a DataType error.......The field is Number. Code: [mem num]=dmax("[mem num]","memberlist") + 1 ----this works, but --[mem num]=dmax("[mem num]","memlist",[mem num]![memlist] is null results in a "type mismatch"......mem num is set as a number in properties...

MS Office VBA Automation Specialist #2
Hi there, is there such a certificate? MS Office VBA Automation Specialist, I tried googling it on microsoft website and couldn't find any info. I just passed the excel 2k expert exam and I want to take the excel instructor exam, I haven't however been an instructor. is it possible to take the exam without an instructor experience? last but not least, I am thinking about putting together some excel webcasts for beginners for free. I have always liked to learn by audio/visual versus reading so I am thinking about implementing this... here is the link for the first test webcast ...

Using OUTPUT TO in VBA, then how to modify the XLS from Access?
I'm using the simple "OUTPUTTO" command to send a query over to Excel, however we will have many users and we would like to programmatically add the header rows, date printed, turn on the auto filter and freeze panes, all of which I can do within a Macro in Excel, but how do I call that macro to run from Access and How to run it on the file that they just created? Current Code: DoCmd.OutputTo acOutputQuery, "MainRptWUser", acFormatXLS, , True "ThriftyFinanceGirl" wrote: > I'm using the simple "OUTPUTTO" command to send...

excel opens up looking like it is in ms dos
how can I get my excell to stop opening up looking like it is in MS-DOS mode. I get an error message that wants to send the info to microsoft, when it hit yes send or no don't send it then shuts down. Hi what exact error message do you get and does this happen all the time for all files? -- Regards Frank Kabel Frankfurt, Germany osborne4 wrote: > how can I get my excell to stop opening up looking like it is in > MS-DOS mode. I get an error message that wants to send the info to > microsoft, when it hit yes send or no don't send it then shuts down. Sounds like you...

how to jump to the next column with "enter" in excel?
Hi, The "tab" key is not an option? "dragos" <dragos@discussions.microsoft.com> wrote in message news:076B9F2B-AE6B-4DCD-96ED-6B5AAE35DC4B@microsoft.com... > ...

Percentile: Different Result Using VBA?
If I populate some cells on an Excel spreadsheet with, say, 1, 2, 3, 4; and then set another cell to =Percentile([cell range], .9) I get a result of 4. OTOH, if I'm in VBA and feed the those numbers to gExcelApp.WorksheetFunction.PercentRank, I get 3.7. Only diff I can see is the use of a VBA array of double to pass the numbers 1-4. Does this sound familiar to anybody? -- PeteCresswell Try formatting the cell containing the percentile function to display some decimal places: then you'll get 3.7 as expected. "(PeteCresswell)" <x@y.Invalid> wrote in message news...