ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   refedit errors when tabbing to another control (https://www.excelbanter.com/excel-programming/341706-refedit-errors-when-tabbing-another-control.html)

David Welch[_3_]

refedit errors when tabbing to another control
 
Hi,

I have a userform with three controls (refedit, checkbox and
commandbutton) setup with the tabindex property to go to
refedit-checkbox-commandbutton.

When I select a range in the current worksheet and press tab the
CheckBox1_Enter event fires fine. However, when I select a range in a
different worksheet and press tab the CheckBox1_Enter event doesn't fire.

Hmmm, does anyone have a solution to this problem (not using
inputboxes/old style DialogSheet refedits). I've always known there is
a problem with RefEdit events, but I did not think it disrupted events
of other controls on the form!!!

Here is code for the CheckBox1_Enter event:

Private Sub CheckBox1_Enter()
On Error GoTo Failed
Dim rng As Range
Set rng = Application.Range(RefEdit1.Text)
rng.Worksheet.Activate
rng.Cells(1, 1).Activate
Failed:
End Sub

---
Dave


All times are GMT +1. The time now is 05:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com