I have a macro that copies the value of a cell located in a remote workbook to Q13, the cell in BOM sheet cell K44 is the total cell of the column and it can move down if I add a row to the table. If no row is added the macro works perfectly, but when I add a row to the table the cell does not update the value to the new position of the total "K45"
I am new to vba and I haven't been able to figure it out this one, can someone help please.
Private Sub CommandButton5_Click()
For i = 10 To 10
FldrName = Cells(5, i).Value
Application.EnableEvents = False
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'Workbooks.Open "\\Server-Master\D\Engineering Drawings\" & FldrName & "\BOM -" & FldrName & ".xlsx"
Workbooks.Open "D:\Engineering Drawings\" & FldrName & "\BOM -" & FldrName & ".xlsx"
ThisWorkbook.Sheets(Format(Range("E8").Value)).Range("Q13").Value = ActiveWorkbook.Sheets("BOM").Range("K44").Value
Application.DisplayAlerts = True
ActiveWorkbook.Close False
Application.ScreenUpdating = True
Application.EnableEvents = True
Next
End Sub
Bookmarks