Update of cell not showing correctly without manual enter

JannetteChristie

Board Regular
Joined
Dec 14, 2015
Messages
127
Office Version
  1. 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.

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
 

Attachments

  • Capture.PNG
    Capture.PNG
    29.5 KB · Views: 20

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
On the change of the value in M4, it is running another another procedure successfully to extract the data (to a different sheet) but the values in the visible sheet are not updated (they are vlookup's)

I have tried SendKeys but with no success
 
Upvote 0

Forum statistics

Threads
1,223,264
Messages
6,171,081
Members
452,377
Latest member
bradfordsam

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