Text in cell return formula

HelJLL

New Member
Joined
Jul 27, 2023
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi All,
Really new to VBA but I'm trying to do the following.
If there is a value in a particular cell it needs to then return a formula in another cell however it needs to reference back to a name in another cell.
So in the following snip, the formula needs to return in the yellow highlighted based on the 4 in A1 however it needs to reference to the name in B1.
1690432558781.png

The code I have is;

Sub Check_Cell_is_empty_alt()
Dim cel As Range
For Each cel In Range("A1:A30")
If cel.Value = 4 Then
cel.Offset(0, 2).Formula2 = "=FILTER(Table!$3:$7,B1=Table!$2:$2)"
Else
End If
Next cel
End Sub

The issue is the yellow highlighted B1 doesn't change when I run the VBA it just stays as B1........ I hope I've explained this.
Thanks,
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Use:

Code:
 "=FILTER(Table!$3:$7,B” & cel.row & “=Table!$2:$2)"
 
Upvote 0
Looks like my iPad added smart quotes instead of normal ones. It should be:

"=FILTER(Table!$3:$7,B" & cel.row & "=Table!$2:$2)"
 
Upvote 0
Solution

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,021
Latest member
pingpong7117

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