Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run code from within a UserForm
What I have is a DialogBox (called DataInput) with a large number of
TextBoxes and when I exit each one of the text boxes I wanted to run the code below. So in an effort to reduce the number of lines of code, I had hoped I could have just entered one line: Module2.DisplayPay But I get an object required error. Sub DisplayPay() Dim rng Set rng = Cells(ActiveCell.Row, 1) TextBox611.Value = rng(1, 99) TextBox612.Value = rng(1, 104) TextBox613.Value = rng(1, 109) TextBox614.Value = rng(1, 114) TextBox615.Value = rng(1, 119) End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run code from within a UserForm
You need to prefix the TextBox controls with the name of the userform. E.g., UserForm1.TextBox611.Text = rng(1,99) Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Wed, 18 Mar 2009 11:27:56 -0700, "Patrick C. Simonds" wrote: What I have is a DialogBox (called DataInput) with a large number of TextBoxes and when I exit each one of the text boxes I wanted to run the code below. So in an effort to reduce the number of lines of code, I had hoped I could have just entered one line: Module2.DisplayPay But I get an object required error. Sub DisplayPay() Dim rng Set rng = Cells(ActiveCell.Row, 1) TextBox611.Value = rng(1, 99) TextBox612.Value = rng(1, 104) TextBox613.Value = rng(1, 109) TextBox614.Value = rng(1, 114) TextBox615.Value = rng(1, 119) End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run code from within a UserForm
Thank you
"Chip Pearson" wrote in message ... You need to prefix the TextBox controls with the name of the userform. E.g., UserForm1.TextBox611.Text = rng(1,99) Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Wed, 18 Mar 2009 11:27:56 -0700, "Patrick C. Simonds" wrote: What I have is a DialogBox (called DataInput) with a large number of TextBoxes and when I exit each one of the text boxes I wanted to run the code below. So in an effort to reduce the number of lines of code, I had hoped I could have just entered one line: Module2.DisplayPay But I get an object required error. Sub DisplayPay() Dim rng Set rng = Cells(ActiveCell.Row, 1) TextBox611.Value = rng(1, 99) TextBox612.Value = rng(1, 104) TextBox613.Value = rng(1, 109) TextBox614.Value = rng(1, 114) TextBox615.Value = rng(1, 119) End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to get variables from worksheet code to userform code | Excel Programming | |||
userform and VBA code | Excel Programming | |||
code help w/userform | Excel Programming | |||
Help with UserForm Code | Excel Programming | |||
Userform Code | Excel Programming |