Can we make this macro find the results of a formula?

ghostbroker2

Board Regular
Joined
Feb 13, 2017
Messages
58
[FONT=&quot]This macro is housed in a workbook called "Production Sheet" and captures an employee ID number from K1 and opens another spreadsheet called DATA RECEPTACLE. Then it searches column B for the ID number and dispenses statistics into that row. We tried connecting the DATA RECEPTACLE to a spreadsheet that houses employee ID#'s and names (Rewinding Roster). The macro then began to fail, & I believe that it is because it was finding the formula (='\\RWCAD\Rewinding Schedule\PRODUCTION REPORTS\REWINDER TRACKING\Rewinder Tracking\MASTER Rewind Tracking\[Rewinding Roster.xlsx]Sheet1'!A2) instead of the result of the formula. Can we modify this macro to search column B's formulas results for a match to K1 from the Production Sheet?[/FONT]


Sub macSubmitProduction()

Dim W, wbSource As Workbook
Dim c As Range
Dim lngR As Long

Set wbSource = ActiveWorkbook
Set W = Application.Workbooks.Open("C:\Tracking Spreadsheets\DATA RECEPTACLE.xlsx")
Set c = W.Sheets(1).Range("B1:B60").Find(wbSource.Sheets(1).Range("K1").Value)

If c Is Nothing Then
MsgBox wbSource.Sheets(1).Range("K1").Value & " Was Not Found!"
Exit Sub
End If

lngR = c.Row

With W.Sheets(1).Cells(lngR, "G")
.Value = .Value + wbSource.Sheets(1).Range("F5").Value
End With
With W.Sheets(1).Cells(lngR, "G")
.Value = .Value + wbSource.Sheets(1).Range("F4").Value
End With
With W.Sheets(1).Cells(lngR, "E")
.Value = .Value + wbSource.Sheets(1).Range("F3").Value
End With
With W.Sheets(1).Cells(lngR, "D")
.Value = .Value + wbSource.Sheets(1).Range("T1").Value
End With

W.Close True

Call macUpdateProd

Call macSave

End Sub


[FONT=&quot]Your expertise is greatly appreciated.[/FONT]
 

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,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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