ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   UserForm question (https://www.excelbanter.com/excel-programming/286660-userform-question.html)

Doug[_9_]

UserForm question
 
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



John Wilson

UserForm question
 
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" wrote in message
...
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






All times are GMT +1. The time now is 03:03 AM.

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