Feb 3rd, 2007, 07:55 AM
#1
Thread Starter
Addicted Member
[Resolved]Cell Formats - hh:mm:ss converts to dd/mm/yy hh:mm:ss
Hi,
I am extracting values in the format of hh:mm:ss from one spreadsheet and storing it into a string
i then add the value stored in that string to another value stored in another string(hh:mm:ss)
when i then paste the new value into another workbook, the format becomes
dd/mm/yy hh:mm:ss
and in the example below the format of the destination cell becomes "scientific", although i had already set the format to hh:mm:ss
do you know how i can sort this, is it because i am adding variables using cells?
here is an example of part of the code, as this is kinda hard to explain
the variables that end in "t" are my temp variables
VB Code:
'location of unavailable
ranPers.Cells(201).Select
strUnavailt = ActiveCell.Value
Range("K1").Value = strUnavailt
Range("K2").Value = strUnavail
Range("K3").Formula = "=sum(K1:K2)"
strUnavail = Range("K3").Value
Range("K1:K3").Clear
Last edited by Mitch_s_s; Feb 9th, 2007 at 09:50 AM .
Feb 3rd, 2007, 09:12 AM
#2
Re: Cell Formats - hh:mm:ss converts to dd/mm/yy hh:mm:ss
does this help?
VB Code:
Private Sub CommandButton1_Click()
'Extracting value from a cell
str1 = Sheets("Sheet1").Range("A1").Value
'Say a string which has a value in "hh:mm:ss" format
str2 = "08:00:00"
'Adding them
Sum = Val(Format(str1, "0.00")) + Val(Format(str2, "0.00"))
'storing the sum in another cell in another sheet
Sheets("Sheet2").Range("A10").Value = Sum
'changing the format of this cell to "hh:mm:ss" format
Sheets("Sheet2").Range("A10").NumberFormat = "hh:mm:ss"
End Sub
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Feb 3rd, 2007, 12:57 PM
#3
Thread Starter
Addicted Member
Re: Cell Formats - hh:mm:ss converts to dd/mm/yy hh:mm:ss
cheers mate
when i change the format to hh:mm:ss it remains the other way
i right click and edit the cells properties
what my sub does is go through the worksheet and adds up certain cells depending on whether the title of the range meets the criteria
as its loopin its doin the above code
is it the way vba is storin the code?
Feb 3rd, 2007, 01:38 PM
#4
Thread Starter
Addicted Member
Re: Cell Formats - hh:mm:ss converts to dd/mm/yy hh:mm:ss
when the macro has run
if i format the cell to be hh:mm:ss
it remains in the format of dd/mm/yy hh:mm:ss
is this because it may have exceded 24 hours?
which it more than likely has....
Feb 3rd, 2007, 01:53 PM
#5
Thread Starter
Addicted Member
Re: Cell Formats - hh:mm:ss converts to dd/mm/yy hh:mm:ss
it's in work, i will go in tomorrow and email it to myself
then i will up it
but it basically loops and counts up all the unavailable time for each individual on each time
ie team 1
it will sum all the unavailable time for team one, and will store it in strUnavail
Feb 3rd, 2007, 02:04 PM
#6
Re: Cell Formats - hh:mm:ss converts to dd/mm/yy hh:mm:ss
Oh... Ok
try this
VB Code:
Private Sub CommandButton1_Click()
'Extracting value from a cell
str1 = Sheets("Sheet1").Range("A1").Value
'Say a string which has a value in "hh:mm:ss" format
str2 = "08:00:00"
'Adding them
Sum = Val(Format(str1, "0.00")) + Val(Format(str2, "0.00"))
'storing the sum in another cell in another sheet
Sheets("Sheet2").Range("A10").Value = Sum
'changing the format of this cell to "[h]:mm:ss" format
'so it shows the sum....
Sheets("Sheet2").Range("A10").NumberFormat = "[h]:mm:ss"
End Sub
Does this help?
ps: Are you working in a contact centre?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Feb 3rd, 2007, 02:05 PM
#7
Thread Starter
Addicted Member
Re: Cell Formats - hh:mm:ss converts to dd/mm/yy hh:mm:ss
yeah
we use seagate enterprise reports
but they wont change them as we are getting rid of rockwell at the end of the year
Feb 3rd, 2007, 02:08 PM
#8
Re: Cell Formats - hh:mm:ss converts to dd/mm/yy hh:mm:ss
yeah
we use seagate enterprise reports
but they wont change them as we are getting rid of rockwell at the end of the year
Me too
rockwell Issss... pathetic...
I think now your problem will be solved... check it out...
Have changed the format to "[h]:mm:ss"
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Feb 3rd, 2007, 02:25 PM
#9
Thread Starter
Addicted Member
Re: Cell Formats - hh:mm:ss converts to dd/mm/yy hh:mm:ss
what do the [ ] 's do to the formatting?
we're going to cisco(sP) the back end of 2007
so no development will be happenin with any rockwell reports
its better in the long run as we will be getting business objects, i will test this out when i'm next in work
not gonna go in tomorrow, cant be bothered lol
Feb 3rd, 2007, 02:35 PM
#10
Re: Cell Formats - hh:mm:ss converts to dd/mm/yy hh:mm:ss
If you are working with times and you want Excel to display hours greater than 24, use the custom format [h]:mm:ss
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Feb 3rd, 2007, 02:36 PM
#11
Thread Starter
Addicted Member
Re: Cell Formats - hh:mm:ss converts to dd/mm/yy hh:mm:ss
sound
that will do me, tar for that mate
do i just rate one post or all?
Feb 3rd, 2007, 04:21 PM
#12
Thread Starter
Addicted Member
Re: Cell Formats - hh:mm:ss converts to dd/mm/yy hh:mm:ss
i'll check in work, when i'm next in then i will update
cheers
Feb 8th, 2007, 06:22 PM
#13
Thread Starter
Addicted Member
Re: Cell Formats - hh:mm:ss converts to dd/mm/yy hh:mm:ss
heres attached my files
cant suss it out
doesnt appear to be calculating AHT and total handled time correctly...
Attached Files
Feb 9th, 2007, 03:05 AM
#14
Thread Starter
Addicted Member
Re: Cell Formats - hh:mm:ss converts to dd/mm/yy hh:mm:ss
Feb 9th, 2007, 03:05 AM
#15
Thread Starter
Addicted Member
Re: Cell Formats - hh:mm:ss converts to dd/mm/yy hh:mm:ss
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width