User Form - Not Allowing Certain Cells to be Selected via TA

ElectricSkywalker

Board Regular
Joined
May 27, 2002
Messages
112
A question on user forms:

Is there a way when using a UserForm to stop a Text Box being selected when someone tabs through the form.

I have one text box that is Actual Data and the other text box is Budget data (which I have a lookup linked to). The Budget Data is for display purposes only).

I have worked out to Stop someone from entering data into the cell, but I have not worked out how to stop the text box being highlighted when I tab through. IS THIS POSSIBLE?

thank you
 

Some videos you may like

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

phantom1975

MrExcel MVP
Joined
Jun 3, 2002
Messages
3,962
I'm not sure if this will solve the problem the way you want, but you can give it a shot.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim C As String
Dim R As String
C = "A"
R = "1"
Do Until R = "20"
If ActiveCell.Address = "$" & C & "$" & R Then
Range("B1").Activate
End If
R = Val(R) + 1
Loop
End Sub

This will keep anyone from selecting cells A1:A20

Does this help?
 

ElectricSkywalker

Board Regular
Joined
May 27, 2002
Messages
112
Andrew,

I ended up going to Properties and finding:

Tab Stop = False

I also had a look at what you offered, being the Enable Function.

They both work....but whats the difference????
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
The Enabled property specifies whether a control can receive the focus and respond to user-generated events. If False the user cannot interact with the control by using the mouse, keystrokes, accelerators, or hotkeys (including TAB).

The TabStop property indicates whether an object can receive focus when the user tabs to it. But if Enabled is True the user can still interact with the control eg by clicking it with the mouse.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,514
Messages
5,602,091
Members
414,501
Latest member
mdhaumyu

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
Top