Tabbing from cell to textbox

Bargos

New Member
Joined
Aug 12, 2005
Messages
19
Hi everyone,

I hope you are all well.

Im working on a protected spreadsheet that has a combination of textboxes and cells in which I need to be able to tab from a cell to a textbox and back again.

I can tab from a cell to a textbox ok by working out what cell the tab key *should* have taken the cursor to and then using textbox1.activate to put the cursor where I want it.

The problem is that the focus of the spreadsheet is not at the textbox that I have redirected it to and logically enough it is still at the cell that it would have been until I redirected it. I naturally assumed that 'textbox1.setfocus' would work to line things up but I textbox1 does not seem to have that method associated with it.

Any ideas please?

B.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Thanks Andrew.

However my code looks similar to this anyway :

dim lastcell as string

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Select Case Target.Address
Case "$F$12"
lastcell = "F12"
Case "$D$39"
If lastcell = "F12" Then
TextBox1.Activate
End If
End
End Select

Textbox1 lies in the tab order between F12 and D39 so, when Im in F9 and hit the tab key the cursor moves to D39, works out that it should be in textbox1 and moves it there. The problem is that the focus is still at D39 although the cursor is in textbox1, offscreen.
 
Upvote 0

Forum statistics

Threads
1,226,618
Messages
6,192,050
Members
453,693
Latest member
maverick688

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