Address and Match formula into VBA Code

thegamemike

New Member
Joined
Mar 26, 2019
Messages
7
=ADDRESS(MATCH(IDNum,Database!C:C,0),MATCH(D10,Database!1:1,0))


***I want to replace the "CELLEXP" on the below code with the above formula, is that possible..? Please help.. Thanks.***
***My goal is to know which cell to add the "ExpAmt" to.


Sub AddExpense()


Dim d As Double
Dim rngClear As Range
Dim inputWks As Worksheet


Set inputWks = Worksheets("Data Input")
Set rngClear = inputWks.Range("ExpenseClear")


d = Range("CELLEXP").Value


Range("CELLEXP").Formula = "=" & d & "+ExpAmt"


rngClear.ClearContents


End Sub
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Why do you appear to want to get a value from a cell and then replace the value in that cell with a formula that includes that value?

Can you explain, in words, what you are trying to do?
 
Upvote 0
Why do you appear to want to get a value from a cell and then replace the value in that cell with a formula that includes that value?

Can you explain, in words, what you are trying to do?

I want to add a specific value entered into a particular cell.
To determine the cell where I should add it to, i used the formula as said above. =ADDRESS(MATCH(IDNum,Database!C:C,0),MATCH(D10,Database!1:1,0))

And every time I enter the value to the particular cell. I want it to addup to the cell where it adds it to.

To be concrete, there are 2 sheets in my workbook. on Sheet1, I enter an amount in a certain cell. Once entered, I want it to addup to a cell in sheet2.

To detemine which cell in sheet2, it will consider 2 data entered in sheet 1 which will represent as column and row of sheet 2.
 
Upvote 0
Which cell are you entering the amount in and which cells are used to determine the cell on the other worksheet that amount should be added to?
 
Upvote 0
Which cell are you entering the amount in and which cells are used to determine the cell on the other worksheet that amount should be added to?

Which cell are you entering the amount in = D11

which cells are used to determine the cell on the other worksheet that amount should be added to = D5 and D10

 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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