Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Excel


Format Second(Now) In Vba 2 Return Seconds In Tenths *

How do you format


to display tenths, hundredths, or thousands of a second? Must be in code since it will never be applied to a cell.

View Complete Thread with Replies

Sponsored Links:

Related Forum Messages:
Converting Minutes, Seconds And Tenths Of Seconds Into Seconds
I want to change 1 minute 24 seconds and 5 tenths into a seconds number. So basically it would come out as 84.50 seconds.

View Replies!   View Related
Time Format: Format Cells To Contain Minutes, Seconds And Hundredths
How can I format cells to contain Minutes, Seconds and Hundredths of seconds to be used in calculations eg 1.24.99 means 1 minute and 24.99 seconds. Example calculation is: 1.24.99 - 1.24.90 =0.0.09

View Replies!   View Related
Format For Time In Seconds
I have a report that tells me how many items are completed every "x" seconds for a person. What I would like to do is when I enter that information into my spreadsheet is to have it calculate those seconds into minutes and seconds. (i.e. I will enter 105 (seconds) into a cell and I want it to display 1:45. Is there a formula or setting in the cell format that can do this? The problem I am going to have is that I will have to enter in each cell as seconds every time and then need it to convert to the minute and second format.

View Replies!   View Related
Format A Cell To Do Minutes And Seconds
is there away to format a cell to do minutes and seconds? then get an overall sum?

View Replies!   View Related
Format Cells As Fractions Of Seconds
I am trying to set up a workbook to record times for our swimming club. This will involve recording the swimmer's time as minutes, seconds, tenths and hundredths. I would then want to be able to compare the new time to the swimmer's previous personal best and calculate the difference.

View Replies!   View Related
Format For Degrees, Minutes & Seconds
I have a column in excel which includes numbers like (12 13 14.5), and I want to format like this (12 Degree Sign, 13 Minute Sign, 14.5 Second Sign).

View Replies!   View Related
Format Time To Show Hours, Minutes & Seconds
is there a way in VB to make it fast, and tidy, clear the contents of all unlocked cells on one sheet ?

View Replies!   View Related
Convert Decimal Minutes & Seconds To Total Seconds
How can I Convert Decimal Minutes & Seconds To Total Seconds?

Here is the sample

View Replies!   View Related
Convert Seconds Into Hours, Minutes & Seconds
I have a spreadsheet that imports data relating to phone call durations. The information imports as a total number of seconds taken.

What I need to do is to change that number of seconds into hours, minutes and seconds.

Changing the format of the cells doesn't work.

I've tried everything I can think of, and run out of ideas.


23 needs changing to 00:00:23
96 needs changing to 00:01:36
268 to 00:04:28
9374 to 02:35:14

View Replies!   View Related
Convert Hours, Minutes And Seconds Into Total Seconds
I trying to figure a formula to convert time on a phone call eg. 01:01:21 into total seconds (3661). Phonecalls will never be more than an hour long but the spreadsheet I will be supplied with (havn't got it yet!) will display them in the 00:00:00 format.

View Replies!   View Related
Convert H:mm To H:tenths
How do I get a straight conversion from h:mm to h:tenths? As soon as it hits 23:59, the clock start over in the tenths column. ie...39:27 should read 39.4. I'm currently using this formula: =(T10-INT(T10))*24


View Replies!   View Related
Converting Seconds Or Minutes:Seconds To A Number
How would I go about converting - for example:

0:22 (formated general) to a number = 22


1:30 (formated general) to a number = 90

View Replies!   View Related
Hours:minutes:seconds Convert To Seconds
I am trying to convert a number of "hours" "minutes" and "seconds", to give me a result in seconds only, in order that I may then financially cost the amount of time spent on a task. (A time and motion costing exercise)


Represents 1119hours:48minutes:36seconds spent on a task.

I can manually convert this to 4031286 seconds, but it just takes too much time !!!(sorry!)

The data is extracted from a database which is unable to split the hours,minutes,seconds into seperate fields, which prevents me from using three cells in excel.

View Replies!   View Related
Convert Seconds Into Hours:Minutes:Seconds
Is there an easy way of converting seconds from using a time into hours, minutes, seconds

View Replies!   View Related
VBA: Format Amts Into Text $ 9.99 Type Format
Need to create a set of aligned text amts from various cells...Tried Format but unable to get right combination...I've looked at many threads and most seem related to getting amt from text instead of reverse.

Cell may contain nothing or a monetary amt, negative or positive. Output needs to be in format of "$9,999.99-" or similar...with leading zeros suppressed but a min of "$ 0.00" showing, so that above/below amts with be decimal point aligned in a fixed font situation.

I've almost gotten my routine finsihed but this is last remaining obstacle.

View Replies!   View Related
Vba Code To Format Date In The Format Dd-mm-yy
I would like to format my cells containg date from any format to the format dd-mm-yy. I was doing this manually with the below function


I would like to automate this using vba. i tried a bit but doesn't get what i want. ultimately i want the date in text(dd-mm-yy) format.

View Replies!   View Related
Lookup To Return Value And Format
My workbook contains two worksheets a scorecard template and a data sheet. I use the lookup function to retrieve statistics from the data to populate various fields in the scorecard template. The value can be numeric, currency or percentages depending on the lookup criteria. Although the data shows the correct formats in the data sheet, when the lookup retrieves the value it only shows the value as number format. Is there a way the cell can retrieve the cell format information as well as the value and apply it to the cell

View Replies!   View Related
Return A Value Based On Cell Format
I don't even know if this is possible but can you use some formula within Excel to return a value to a cell based on the cell formatting of another cell? Here is specifically what I am trying to do:

Cell A2 has a value of 10. If the font color of that cell is black (or "automatic") I want a formula in cell A1 that will return a value of "+10". If the font color of cell A2 is red, I want the formula in cell A1 to return a value of "-10".

View Replies!   View Related
Return Numbers With Specific Format
I am trying to return a number with a specific format. I need Excel to look in a particular column and when it finds the entry in the correct format to return it in a new column. I want it to repeatedly return the number to the new column until it finds another number of the same format in the original column.

View Replies!   View Related
Time Conversion: Convert A Time From Hours/Minutes To Hours/Tenths
When I am converting a time from Hours/Minutes to Hours/Tenths, Excel is not converting it consitantely. EXAMPLE: 1:15 = 1.25. When I format the cell to present only one place past the decimal point, sometimes the cell will round up to 1.3, and other times it will round down to 1.2. What am I missing?

View Replies!   View Related
VBA For Italic Format
I'm kind of new to the whole VBA stuff but I've got a feeling that what I need is possible using it:
I've got a file with lots of worksheets ("data entry", "Austria", "uk",... just as examples). On the Austria and UK sheets I've got names of companies in italics and I need them to become Regular (non-Italics) when I change the letter F into D in column E on "data entry" sheet.

View Replies!   View Related
Format Fucntion In VBA
I'm trying to use Format function in a Macro like this:


In my idea, it should return "Feb", however I get "Jan"...

View Replies!   View Related
Conditional Format In VBA


Disregard the First Table. I cant remove it. refer to the Second Table

This table is a Task Tracker. The Start Button Adds the Current Date in Enercon's Row C1 and the row below (C2) will automaticaly filled with color using Conditional Formating. My Question is how can I code a conditional format for Trail1 Rows. For example when Trail1 Cell is active then you click the start Button instead of Coloring D2 Cell it should Color D3 Cell.

Here is the Code in Start Button

Sub cmdStart_Click()
Dim i As Integer
Results = MsgBox("Are you working on " & ActiveCell.Value & " today ?", vbOKCancel, "")
If Results = vbOK Then

With Sheets("Sheet1")
i = .Cells(2, Columns.Count).End(xlToLeft).Column + 1
.Cells(2, i).Value = Now()
i = i + 1

End With
End If
End Sub

View Replies!   View Related
Compare Format In VBA
how to compare format in VBA

eg: I want to check if a particular cell has this format "MM/DD/YYYY hh:mm"

View Replies!   View Related
Format Cell Using VBA?
Is it possible to change the border and color of a cell using VBA?
Also I need to know how to change the cell's font to Bold.

View Replies!   View Related
VBA Convert Format
I have a spreadsheet that in various cells have numbers that have been been formated as text and have a leading zero and therefore displays the green flag in the corner of the cell. I want to change them to number format and clear the green flag.

using something like
Cells.NumberFormat = "0.00"

doesn't seem to work. whist it shows the format as number it still leaves the green flag and the leading zero.

View Replies!   View Related
Carriage Return In VBA
I need to include over 70 data fields in a pivot table that I want to add/remove with a pivot. They need to have an alternative caption and be formatted.
I am currently using the following piece of
With ActiveSheet.PivotTables("PivotTable1").PivotFields("tytwprods_v_lytwprods_(abs)")
.Orientation = xlDataField
.NumberFormat = "#,##0"
.Function = xlSum
.Caption = "Products 2007-08"

However, I need to do this many times and it is a bit painful. I have created a spreadsheet with concatenated fields to create the above, although on one line which isn't liked by VB.

How can I make my code work but with it all on one line like:

With ActiveSheet.PivotTables("PivotTable1").PivotFields("tytwprods_v_lytwprods_(abs)").Orientation = xlDataField .NumberFormat = "#,##0" .Function = xlSum .Caption = "Products 2007-08"

View Replies!   View Related
Date Format In VBA Userform
I have created a user form with a date field which fills a spreadsheet cell. The spreadsheet cell is formatted to dd/mm/yy but the user form will always enter as mm/dd/yy. Does anyone know how to edit the VBA form to use the dd/mm/yy format.

View Replies!   View Related
Date Format In VBA Userforms
I have a spreadsheet with some data on it along with a button that activates a pop-up/form, which reads from a row of data and inputs it into specified textboxes on the form. All the data comes up nicely in the form, however it doesn't retain the formatting of the dates.

I have have a column title as "Issue Date", and the data in that column is dates. For example, the date would be written as follows in the actual cell "17Sep2009" (as per my custom formatting). However, when VBA reads it, and inputs it into the form, it displays it as numbers. In this case, it reads "17Sep2009" as "40073".

I also have a column that displays money info, so a cell would read "$10.00", however VBA reads it, and inputs it into the form as "10".

I can't change the formatting of the cell to text or anything, as the date formatting is beneficial to some other coding I have going on in the sheet.

I have the following code written to have VBA pull from the cells and display the info in the form:

View Replies!   View Related
VBA Data Label Format
I have a plot that shows the position of a drifting buoy in the ocean. I have created a second series that is just the most recent position of that buoy. Everyday, using VBA, I update the chart 2nd series to point to the location of the new lat and long. For this second series, which is only one point, I have data labels turned on. I replace the data label text with the date and time of that latest position. Here is my problem. I can not find a way to format the date. No matter what I try, it has the format mm/dd/yyyy hh:mm AM/PM. I really just want it to be a 24 hour clock (mm/dd/yy hhmm).

I have tried forcing the format of the variable date_of_latest_pos, I have tried changing the cell format that contains the actual date and time...

ActiveChart.SeriesCollection("Latest Position").ApplyDataLabels AutoText:=True, LegendKey:= False, ShowSeriesName:=True, ShowCategoryName:=False, ShowValue:=False, ShowPercentage:=False, ShowBubbleSize:=False
ActiveChart.SeriesCollection("Latest Position").Points(1).DataLabel.Select
Selection.Characters.Text = date_of_latest_pos
Selection.AutoScaleFont = False
With Selection.Characters(Start:=1, Length:=23).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With

View Replies!   View Related
Multiple Conditional Format Using VBA
Need multiple conditional format for more than 3 condition. I don't know how to write code in VBA.

View Replies!   View Related
FORMAT In VBA On User Forms
Excel 2003

VBA on user forms

View Replies!   View Related
Acheive A 0000 Format In VBA..
I want to acheive a 0000 format in VBA and cannot work it out. I want it for a user id, so it would be 0001, 0002, 0003, 0004 etc.

View Replies!   View Related
VBA Format Number With Leading Zero
I have the following script which is working fine execpt for its limited to running the loop 10 times. The macro is looking for files where the file extension could be anything between .P01 and .P99. Currently, the macro looks for file.P01 then file.P02 etc until it gets to file.P09 by increasing the value of 'i'. The trouble I am having is to get the variable 'i' to have a leading zero when the value is less than 10.

Sub rename_print_files()

Dim OldName, NewName
Dim i As Integer
Dim strResult, strOldName, strNewName As String

Range("E14").Activate ' set first file
Application.DisplayAlerts = False

View Replies!   View Related
Launching Another File Format From Vba
My company uses database software called Business Objects. At the moment few people are using the program and its reports as they can't find the key ones or workout how to run them correctly. As everyone is comfortable with excel. I am creating a series of forms to guide my users to the key reports. I like this method because it is very user friendly and I can add lots of descriptions. Unfortunately my programming knowledge is limited to excel so I can't write a standalone program as you might suggest I do.

The problem:
I want to launch the non-excel files using VBA. For example, a user will click on a "Customer" button to see a second form containing a list of customer reports. The user will then click on the button containing the name of the report they want to launch. I want the file to open. I tried using hyperlinks in an excel spreadsheet which works fine for opening the non-excel files, but it isnít nearly as user-friendly or interactive.

View Replies!   View Related
Always Return 1st Of The Month In VBA
From the code below I need to translate whatever date is input to the First day of the month to pass into my VBA via the variable "SMth"

e.g. entered 12-03-09, returned 01-03-09

SMth = InputBox("Enter date of FIRST month ", "Format like 01-01-07", "01-01-07")
SMth = "=DATE(YEAR(SMth),MONTH(SMth),1)"
Cells(3, 8).Value = SMth
The line

SMth = "=DATE(YEAR(SMth),MONTH(SMth),1)"
is giving me an error, what should that line of code be?
OR perhaps you have another solution to reach the same goal

View Replies!   View Related
Return VBA Created Range
I am trying to create a function in VBA that will return a range, but I don't want the range to point to cells on a spreadsheet. I want the range to return a vba created range. Is this possible or impossible? Is a variable of type range required to point to cells on a spreadsheet?

View Replies!   View Related
Obtain/Return FilePath/Name In VBA
Does anyone know the code for obtaining the filepath of the current workbook? Tried a search and can't find anything on this.

View Replies!   View Related
Return Version With VBA Code
Is there a way to find out which version of excel somebody is using within VBA?

View Replies!   View Related
VBA PasteSpecial Format & Values
I am trying to copy a range from one sheet and paste in another sheet via VBA.

ActiveSheet.Paste Destination:=Range("IV1").End(xlToLeft).Offset(0, 1)
Column E has formulas (=SumB3:D3) nothing more then that. I get a #REF after the paste into the FORCAST sheet.

I would like to Paste Values and Formats.

I tried changing the code to this, with different variations:

ActiveSheet.PasteSpecial Paste:=xlPasteFormats, xlPasteValues _
Destination:=Range("IV1").End(xlToLeft).Offset(0, 1)

But keep comming up with errors.

View Replies!   View Related
Transferring Print Format Info Via VBA
I am using VBA to copy and paste multiple sheets from one workbook to another. The workbook where the sheets are being pasted has no prior formatting. I want to transfer the *print* formats from the first to the second sheet via VBA. One key thing to note is that the print formats are constantly being changed in the first workbook. So I think I need code to "grab" the formats, then transfer them to the second workbook.

View Replies!   View Related
Open No Fixed Name (*.xls*) Format In VBA
I have open a workbook and copy the data from that workbook to another workbook.

Here the problem is workbook name is not fixed. How to oepn that workbook.
I used the belwo statement but giving error "no file name"

View Replies!   View Related
Displaying Sheet In Tabular Format Using Vba
display a sheet in the following format using excel vba ....

View Replies!   View Related
Number Format (4 Decimals Places) In VBA
I am having an issue with number format in my VBA code. The entire column of column D is format as ###.0000 (4 decimals places). There are certains cells which require zero decimal places. I am using the following bit of code, but it is not working correctly. It is still formatting the cell as 4 decimal places.

View Replies!   View Related
Conditional Format (vba Loop Is The Answer)
i have 3 columns and hundreds of rows.... i first applied conditional format to the first row (A1, B1, C1) only. no problems so far as A1 has value '0' which is minimum and B1 is the highest value '200' and C1 is variable value between 200' and 0'. Im using icon sets in this one.... now i want the below rows to have the same conditional format.... how do i do that because when i select them all rows and columns and try to apply conditioanl formatting the outcome is not the same as i got previously in the first somehow combines all the values rather working only on the individual row. i hope u get wat im tryin to say....

i come across a solution in my mind to give a loop in vba to do the conditional formatting each row seperately untill empty cell of column no. 4.... but doing this will obviously eat lot of memory in excel cause of each row will have a seperate conditional format.....

View Replies!   View Related
Setting Format Cell Accounting Using Vba
i am doing some calculations using vba in excel, i need to know how to set the cell format to 'accounting' in vba ?

View Replies!   View Related
Vba Give Format To A Cell- Specify A Type For It
Does anyone have any clue of a VBA function that gets a cell and Changes the type of itīs contense?

I have been using the Cstr function as in the next example but I dont get the result I want

hojaRES.Cells(i, 6) = CStr(hojaRES.Cells(i, 6))
If IsNumeric(hojaRES.Cells(i, 6)) Then
MsgBox "nothin changes :("
Exit For
End If
hojaRES.Cells(i, 6) = "0" & "34" & hojaRES.Cells(i, 6)

My problem is that i want to add 034 prefix to a telephone number, and as it treats the data as numeric; number 0 (before34) is deprecated

View Replies!   View Related
VBA Copy, Paste Rows And Format
I have been trying to set up this macro to copy and paste rows where a tick box is checked. The macro needs to transfer the row A:H over to sheet 2 then insent the data acording to property title either A, B, C etc. into formated tables which then feed into a bar and pie chart. I have tried posting this question up in sections hoping that i could get the bits of code i need and then work out how to do the macro but I have had no luck since my VBA skills are poor. I have attached the file

Private Sub CommandButton1_Click()
Dim lRow As Long, lRow1 As Long, lRow2 As Long
Dim Target As Range
Dim vTemp As Variant
Dim WS2 As Worksheet
Set WS2 = Sheets("Sheet2")
lRow = WS2.UsedRange.Row + WS2.UsedRange.Rows.Count
For Each Target In Range("I1", Cells(Rows.Count, "I").End(xlUp).Address).SpecialCells(xlCellTypeConstants)
vTemp = Target.Value
If VarType(vTemp) = vbBoolean Then
If vTemp = True Then
vTemp = "*"
On Error Resume Next
vTemp = WorksheetFunction.Match(" Total*", Range("A" & Target.Row, "A" & Rows.Count), 0).....................

View Replies!   View Related
Format Time From Cell In VBA Code
I am trying to insert data from an excel sheet to a sql database. Everything works okay but the Time value. In the Excel sheet it is '12:09 PM' and when it is read with 'cl. Offset(0, 6).Value' it turns it into '0.50625'. Is there a way to format it so it can be inserted as a datetime?

Dim cl As Range
For Each cl In Range("A1:A12")
stSql = "INSERT INTO GasData (Delivery,OpenPrice,High,Low,Last,Change,Time) VALUES ('" & _
cl.Value & "','" & _
cl.Offset(0, 1).Value & "','" & _
cl.Offset(0, 2).Value & "','" & _
cl.Offset(0, 3).Value & "','" & _
cl.Offset(0, 4).Value & "','" & _
cl.Offset(0, 5).Value & "','" & _
cl.Offset(0, 6).Value & "')"
cn.Execute stSql

View Replies!   View Related
How To Return Value From VBA User Defined Funtion
how to return value from VBA User Defined Funtion

View Replies!   View Related
Copyright © 2005-08, All rights reserved