UserForm question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two columns of cells that I need to watch. When a user manually changes values in any cells in these two rows, an alert is generated. I can do the above easily enough. I created two UserForms, one for each row, that are generated as the alert. What I need to do is figure out how to indicate in the UserForm the row and column that caused the trigger. In my Sheet1, code, the following give me the Active Column and Active Row:

C = ActiveCell.Column
R = ActiveCell.Row

How can I pass these values to TextBox1 and TextBox2 on a UserForm? If I try putting this code into my UserForm, it always gives me the same values, which makes me think it is giving me the position of the UserForm on the screen, not the values of the last cell the user typed data into.
Thank you in advance.
Doug
 
Doug,

Did you Dim C & R as Public Variables???

Public C as integer
Public R as Long
Sub TestMe()
C = ActiveCell.Column
R = ActiveCell.Row
UserForm1.Show
End Sub

In the UserForm....

Private Sub UserForm_Activate()
TextBox1 = C
End Sub

John

Doug said:
I have two columns of cells that I need to watch. When a user manually
changes values in any cells in these two rows, an alert is generated. I can
do the above easily enough. I created two UserForms, one for each row, that
are generated as the alert. What I need to do is figure out how to indicate
in the UserForm the row and column that caused the trigger. In my Sheet1,
code, the following give me the Active Column and Active Row:
C = ActiveCell.Column
R = ActiveCell.Row

How can I pass these values to TextBox1 and TextBox2 on a UserForm? If I
try putting this code into my UserForm, it always gives me the same values,
which makes me think it is giving me the position of the UserForm on the
screen, not the values of the last cell the user typed data into.
 
Back
Top