How do i do this? Tricky one if possible

ParanoidAndroid

Board Regular
Joined
Jan 24, 2011
Messages
50
Hi Mr Excel

I'm not sure if this is possible to do in a macro, let alone where to start but perhaps you can assist?

Basically I have a column with a range of numbers -

For example
T Column = number in the cell
ie.
T1 = 1
T2 = 22
T3 = 33
T4 = 45

Now i have a line of code
say..Formula( )

I want to plug the values into the brackets in the formula starting from the bottom entry

for example
formula(45)
formula(33)
formula(22)
formula(1)

A couple things...Column T may not have any values places in it or it may have multiple values..it is highly unlikely to be more than 20 let alone 10 rows used in column T.
It needs to be done via macro

Thanks for your help in advance
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Code:
Dim r as range
set r = Range("T1")

Range(YourRange).Formula = "=Sum(" & r.Value & ")"

just replace 'Sum' with whatever your formula is.

If it needs to be dynamic (so updates if the value of T1 changes), then just swap the property ".Value" with ".Address"
 
Upvote 0
Oh and don't forget to qualify your 'MyRange' properly if it goes between sheets or anything like that.

Sorry - you didn't provide much other than "The numbers are in Column T"

I should also add, if 'Blank' cells are a problem, wrap the line I gave you inside an If statement to avoid errors - i.e,

Code:
Dim r as range
set r = Range("T1")

If Not r.value = "" Then Range(YourRange).Formula = "=Sum(" & r.Value & ")"
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

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