VBA for all available rows input formula in column D

LNG2013

Active Member
Joined
May 23, 2011
Messages
465
Should be simple.... I need to say for all rows that have data in them from end up, put this formula =I1-(5/24) in column J. Adjusting the I# for each row.

I am subtracting 5 hours from the time, and need to use this formula to maintain the structure of the other data in the cells.

Cells have a custom format.

Format Cells - Custom - m/d/yyyy h:mm

Excel Workbook
IJ
1TimeAdjustedTime
211/30/11 20:2611/30/2011 15:26
311/30/11 21:3711/30/2011 16:37
412/1/11 0:4211/30/2011 19:42
512/1/11 1:2711/30/2011 20:27
612/1/11 13:3412/1/2011 8:34
Sheet1
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Code:
    With Range("J2:J" & Range("I" & Rows.Count).End(xlUp).Row)
        .FormulaR1C1 = "=RC[-1]-5/24"
        .NumberFormat = "m/d/yyyy h:mm"
    End With
 
Upvote 0

Forum statistics

Threads
1,213,534
Messages
6,114,186
Members
448,554
Latest member
Gleisner2

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