How to activate a User Form

R

Rob

Hi,
I would like to activate a User Form with text box when a range of values
meets specific criteria.

Assuming B3 to B26 is the active range with values and the range A3 to A26
contains text with three letters in each cell.

At the moment the code to activate the User Form looks like this:

Sub CheckVolumeRise2 ()
If ActiveCell < ActiveCell.Offset(0, 2) And ActiveCell.Offset(0, 2) < _
ActiveCell.Offset(0, 4) Then
ActiveCell.Offset(0, 2).Activate
CriteriaReached.Show
Else
ActiveCell.Offset(0, 2).Activate
End If
StartTimer
End Sub

The User Form Text Box code looks like this:

Private Sub UserForm_Initialize()
CriteriaReached.TextBox1. _
Text = ThisWorkbook.Worksheets(1).Range("a6").Value
End Sub

At the moment the User Form (named CriteriaReached) Text Box will only show
ADO which is the three letters in cell A6.

What I am trying to achieve, is that if for example, the criteria was
reached in row 13 then the User form would activate and the text in cell A13
which might be AAO would show in the text box of the User Form. Or if
multiple rows reached the criteria at the same time for example rows 9 ,12
and 25 the text box would show something like this AAI, AAM, ABV.

I would appreciate any help I can get on this.

Thank you.
 
P

Per Jessen

Hi

Thy this:

Private Sub UserForm_Initialize()
CriteriaReached.TextBox1. _
Text = ThisWorkbook.Worksheets(1).Range("A" & ActiveCell.Row).Value
End Sub

Regards,
Per
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top