Help writing code in VBA

Mav93

Board Regular
Joined
Feb 21, 2005
Messages
107
Hi everybody!!!!

I have a piece of code that I need some help with.

Workbooks("Olson Bros Bid Information Sheet.xls").Sheets("data").Range( ? ).Value = ActiveWorkbook.Sheets("cost sheet").Range("AH7")

The help I need is inregards to the ?. I have a formula that I use in my regular worksheet that gives me the correct range. Here is the formula:

="E"&TEXT((MATCH(AH7,'[Olson Bros Bid Information Sheet.xls]data'!$B$5:$B$281,0)+4),"0")

I'm not sure how to correctly write the above code to include the formula.

thanks for any help in advance
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Try:

Code:
Sub Test()
    Dim CellVal As Variant
    Dim CellRef As Long
    CellVal = ActiveWorkbook.Sheets("cost sheet").Range("AH7").Value
    CellRef = Evaluate("=MATCH(" & CellVal & ",'[Olson Bros Bid Information Sheet.xls]data'!$B$5:$B$281,0)+4")
    Workbooks("Olson Bros Bid Information Sheet.xls").Sheets("data").Range("E" & CellRef).Value = ActiveWorkbook.Sheets("cost sheet").Range("AH7")
End Sub
 

Forum statistics

Threads
1,171,732
Messages
5,877,172
Members
433,236
Latest member
Yelnats23

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
Top