Code to input text requires double click to work

Trixsix

New Member
Joined
Jun 29, 2017
Messages
3
I have a piece of code that is set to input "yes" or "no" into a specific cell dependant on user input on a different sheet. I can only get the "yes" or "no" to appear when I double click the cell and press enter. Is there anyway to refresh or double click the cell within VBA? I have checked the workbook calculation options are set to automatic.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Welcome to the Board!

Please post your code so we can see what it is to do.
 
Upvote 0
Here is the code. I have not really worked with VBA before and some of this was done by a developer who has since been moved to a different project so please bear with me. Thank you.

'Scheme selection to allow correct fields to be shown based on selection
Private Sub Worksheet_Change(ByVal Target As Range)
' On Error GoTo ErrorHandling
Set App = Application
App.ScreenUpdating = False
If blSelCheck = True _
Then Exit Sub _
Else blSelCheck = True
CalcComPI.Unprotect Password:=strPass
'Commutation Required?' Selection
If Sheet3.Range("P66").Value = "Yes" _
Then CalcComPI.Range("E20") = "Yes" _
Else CalcComPI.Range("E20") = "No"
If CalcComPI.Range(strAppCommSel).Value = "Yes" _
Then CalcComPI.Range(strAppCommRows).Rows().Hidden = False _
Else CalcComPI.Range(strAppCommRows).Rows().Hidden = True
blSelCheck = False
CalcComPI.Protect Password:=strPass
App.ScreenUpdating = True
Exit Sub
ErrorHandling:
MsgBox Err.Number & " " & Err.Description, vbOKOnly + vbCritical, "Error: " & Err.Number
blSelCheck = False
Application.DisplayAlerts = True
Application.DisplayFormulaBar = True
Application.ScreenUpdating = True
End Sub
 
Upvote 0
That code is set to run whenever a cell is manually updated (using "Enter" is one way of doing that).
Typically, the way you want these to work, is that you want your Worksheet_Change code associated to the sheet and the cells that you are updating that is supposed to trigger the whole process (not necessarily on the sheet that you want the updates/changes to happen on).
 
Upvote 0
That code is set to run whenever a cell is manually updated (using "Enter" is one way of doing that).
Typically, the way you want these to work, is that you want your Worksheet_Change code associated to the sheet and the cells that you are updating that is supposed to trigger the whole process (not necessarily on the sheet that you want the updates/changes to happen on).


It worked a treat. Thank you! :)
 
Upvote 0

Forum statistics

Threads
1,214,922
Messages
6,122,281
Members
449,075
Latest member
staticfluids

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