ghostbroker2
Board Regular
- Joined
- Feb 13, 2017
- Messages
- 58
[FONT="]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="]Your expertise is greatly appreciated.[/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="]Your expertise is greatly appreciated.[/FONT]