set cell value with vba and get the formula in the Excel function bar

MarieBocc

New Member
Joined
Jun 28, 2019
Messages
33
Hello everyone,

I am trying to set the value of a cell by using vba. The thing is, this cell is in a column where all cells are set by the following formula :

[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]=IF(OR((H17<>"");(F17<>"");(E17<>""));SEARCH("zzz";B$9:$B17);"")

So when the user clicks on any cell, this is what the Excel function bar displays. But if I set my cell value with vba, how can I get my cell to display the same formula in the Excel function bar ?

To begin with, is it even possible ?

[/FONT]
Thank you for reading,

Marie
 
Hello again,

I thought about it from a different angle and here is what I came up with and it worked :biggrin: :

[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]
Code:
Cells(myRow - 1, 1).AutoFill Destination:=Range(Cells(myRow - 1, 1), Cells(myRow, 1)), Type:=xlFillDefault

note : myRow is the row I want to spread the formula to. (The same formula as I have in the whole column -> so also in the previous cell.)
[/FONT]
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,215,639
Messages
6,125,971
Members
449,276
Latest member
surendra75

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