Code needed for formula

John T

Board Regular
Joined
Nov 28, 2013
Messages
145
Office Version
  1. 365
Platform
  1. Windows
Hi, can someone help me with a code for the following task i need.

After running my macro i have amounts in column T from T2 downwards.
I need a formula that if the cell is blank in column T, to the last row of data in that column, it needs to be equal to the value in column J for the same row.

Thanks
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
VBA Code:
Sub jt()
Dim c As Range
    For Each c In Range("T2:T" & Cells(Rows.Count, 20).End(3).Row)
        If c = "" Then cl = cl.Offset(0, -10)
    Next c
End Sub
 
Upvote 0
Thanks. I got a run time error on the cl = cl.offset (0, -10) line but i removed the L and now it seems to work.
Thanks for your help.
 
Upvote 0
Glad i could help & thanks for the feedback.
Corrected code:
VBA Code:
Sub jt()
Dim c As Range
    For Each c In Range("T2:T" & Cells(Rows.Count, 20).End(3).Row)
        If c = "" Then c = c.Offset(0, -10)
    Next c
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,496
Messages
6,113,993
Members
448,539
Latest member
alex78

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