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

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
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
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,273
Members
448,559
Latest member
MrPJ_Harper

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