Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get variables from worksheet code to userform code Donny Excel Programming 6 August 23rd 08 01:31 AM
userform and VBA code [email protected] Excel Programming 6 July 11th 07 10:54 PM
code help w/userform Jennifer Excel Programming 2 May 26th 06 03:47 AM
Help with UserForm Code sneagle Excel Programming 1 November 18th 05 06:41 PM
Userform Code scrabtree23[_3_] Excel Programming 3 December 5th 04 05:05 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"