Help on a VBA Code

hrayani

Well-known Member
Joined
Jul 23, 2010
Messages
1,549
Office Version
  1. 2016
Platform
  1. Windows
Hello Friends,

I am using the below vba Code which is working just perfect applying formulas to range B5:B100

What I want in the vba code is that the formula to pick the second named range "fri1_actual_date" from cell A1

Is it Possible ??

VBA Code:
Sub ApplyFormulaToPendingTargets()

Dim ws As Worksheet  
Set ws = Sheets("PENDING TARGETS")

ws.Range("B5:B1000").ClearContents

ws.Range("B5:B100").Formula = "=IFERROR(AGGREGATE(15,6,orders_ref/(((orders_design_receipt<>"""")*(fri1_actual_date=""""))*ISNA(MATCH(orders_ref,B4:B$4,0))),1),"""")"

End Sub
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
pick the second named range "fri1_actual_date" from cell A1
You have not told us which sheet this particular A1 is on, but see if this is what you mean.

VBA Code:
ws.Range("B5:B100").Formula = "=IFERROR(AGGREGATE(15,6,orders_ref/(((orders_design_receipt<>"""")*(" & Range("A1").Value & "=""""))*ISNA(MATCH(orders_ref,B4:B$4,0))),1),"""")"
 
Upvote 0
Solution
Hi Peter,

Thanks a lot - It is working just perfect - Exactly what I wanted

Sorry for not informing that on which sheet the cell A1 is on
Well, it's on the current active sheet


Shal I continue with it or do we have to mention the sheet name ??
 
Upvote 0

Forum statistics

Threads
1,225,626
Messages
6,186,090
Members
453,337
Latest member
fiaz ahmad

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