Syntax

dsin73

New Member
Joined
Mar 27, 2018
Messages
6
I am not good at VBA but usually fumble my way through.

Trying to translate this which works if I simply paste it into a Cell

=FLOOR(D11*3,1)&" Days and "&TEXT(SUM(D11,-TIME(8,0,0)*FLOOR(D11*3,1))," h") & " Hours " & MINUTE(A1) & " Minutes "& SECOND(D11) & " Seconds"

Into This for my VBA - & below & is basically the next cell down after counting all rows in range D. i.e D14 is last entry then below=D15 (total)

Range("C" & lastrow + 1).Formula = "=FLOOR(D" & below & "*3,1)& "" Days and"" &TEXT(SUM(D" & below & ",-TIME(8,0,0)*FLOOR(D" & below & "*3,1))," h")"
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
If I use this I get the days output perfectly but cannot add the hours on

Range("C" & lastrow + 1).Formula = "=FLOOR(D" & below & "*3,1)& "" Days"" "
 
Upvote 0
If it is try this.
Code:
Range("C" & lastrow + 1).Formula = "=FLOOR(D" & below & "*3,1)&"" Days and ""&TEXT(SUM(D11,-TIME(8,0,0)*FLOOR(D" & below & "*3,1)),"" h"") & "" Hours "" & MINUTE(A1) & "" Minutes ""& SECOND(D" & below & ") & "" Seconds"""
 
Upvote 0
Depending on how you have defined below, you may need to wrap it in a format i.e. replace all occurrences of 'below' with 'format(below)'.
 
Upvote 0

Forum statistics

Threads
1,226,114
Messages
6,189,052
Members
453,522
Latest member
Seeker2025

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top