JannetteChristie
Board Regular
- Joined
- Dec 14, 2015
- Messages
- 127
- Office Version
- 365
Hi,
I have some VBA code that does an update to a cell in a different sheet, however the cell value does not refresh the sheet values and appear correctly until I hit the enter key manually, how can I simulate the enter key in VBA.
I have some VBA code that does an update to a cell in a different sheet, however the cell value does not refresh the sheet values and appear correctly until I hit the enter key manually, how can I simulate the enter key in VBA.
VBA Code:
Sub MassPrintSheets()
'Application.ScreenUpdating = False
Dim ary As Variant, nary As Variant
Dim r As Long, c As Long, rr As Long
Sheets("Mass print of Serial Numbers").Select
NumRows = Range("A1")
ary = Range("B5", Range("B" & Rows.Count).End(xlUp).Offset(, 1)).Value2
For r = 1 To NumRows
If ary(r, 1) > 0 And ary(r, 1) <> "" Then
xSN = ary(r, 1)
Sheets("Sheet1").Select
Sheets("Sheet1").Range("M4") = xSN
Sheets("Sheet1").Range("O4").Select
' ActiveWorkbook.RefreshAll
' UpdateComponentList Target.Value
'Sheets("Sheet1").PrintOut
' Sheets("A4 Despatch Label").PrintOut
Sheets("Mass print of Serial Numbers").Select
End If
Next r
'Application.ScreenUpdating = True
End Sub