Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default populate text boxes from data in worksheet

107I am a rookie excel programmer trying to display data from a worksheet to
textboxes which I thought to be a very simple operation but Excel just
ignores the instuctions i.e Dim Rw As Integer
Rw = 2
TextBox1.Text = Sheet1.Cells(rw,1)
Any help will be appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default populate text boxes from data in worksheet

Your code will work if it is on the same sheet as the textbox, if as you say
it is being ignored without any errors I suspect the code is working, the
reference you are creating is to Row 2, Column 1, e.g. cell A2, have you
anything in cell A2? if not then the code will load "empty" and nothing
will change in the control.

You could fully specify the location of the Textbox, the following example
will work on the sheet code and a standard module.

Sub myCode()
Dim Rw As Integer
Rw = 2
With Sheet1
.TextBox1.Text = .Cells(Rw, 1)
End With
End Sub
--

Regards,
Nigel




"Lyndon107" wrote in message
...
107I am a rookie excel programmer trying to display data from a worksheet
to
textboxes which I thought to be a very simple operation but Excel just
ignores the instuctions i.e Dim Rw As Integer
Rw = 2
TextBox1.Text = Sheet1.Cells(rw,1)
Any help will be appreciated.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default populate text boxes from data in worksheet

Thanks for the info. NIgel.
Unfortunately your suggestion did not work and I felt that I had not given
enough information. My information is on a worksheet and I am trying to
take information from the worksheet and place it into textboxes on a userform
which is loaded from a standard module. When I tried your example Excel told
me it could not find Textbox1
I am struggling with this for the past four days so if you can spear the
time I would certainly appreciate your further help.
lyndon107

"Nigel" wrote:

Your code will work if it is on the same sheet as the textbox, if as you say
it is being ignored without any errors I suspect the code is working, the
reference you are creating is to Row 2, Column 1, e.g. cell A2, have you
anything in cell A2? if not then the code will load "empty" and nothing
will change in the control.

You could fully specify the location of the Textbox, the following example
will work on the sheet code and a standard module.

Sub myCode()
Dim Rw As Integer
Rw = 2
With Sheet1
.TextBox1.Text = .Cells(Rw, 1)
End With
End Sub
--

Regards,
Nigel




"Lyndon107" wrote in message
...
107I am a rookie excel programmer trying to display data from a worksheet
to
textboxes which I thought to be a very simple operation but Excel just
ignores the instuctions i.e Dim Rw As Integer
Rw = 2
TextBox1.Text = Sheet1.Cells(rw,1)
Any help will be appreciated.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default populate text boxes from data in worksheet

Ah, a UserForm! Use something like this to allocate the value (assuming the
UserForm is loaded into memory...

Form a standard module....

UserForm1.TextBox1.Value = Sheet1.Range("A2")

From the UserForm code

Me.TextBox1.Value = Sheet1.Range("A2")


--

Regards,
Nigel




"Lyndon107" wrote in message
...
Thanks for the info. NIgel.
Unfortunately your suggestion did not work and I felt that I had not given
enough information. My information is on a worksheet and I am trying to
take information from the worksheet and place it into textboxes on a
userform
which is loaded from a standard module. When I tried your example Excel
told
me it could not find Textbox1
I am struggling with this for the past four days so if you can spear the
time I would certainly appreciate your further help.
lyndon107

"Nigel" wrote:

Your code will work if it is on the same sheet as the textbox, if as you
say
it is being ignored without any errors I suspect the code is working, the
reference you are creating is to Row 2, Column 1, e.g. cell A2, have you
anything in cell A2? if not then the code will load "empty" and nothing
will change in the control.

You could fully specify the location of the Textbox, the following
example
will work on the sheet code and a standard module.

Sub myCode()
Dim Rw As Integer
Rw = 2
With Sheet1
.TextBox1.Text = .Cells(Rw, 1)
End With
End Sub
--

Regards,
Nigel




"Lyndon107" wrote in message
...
107I am a rookie excel programmer trying to display data from a
worksheet
to
textboxes which I thought to be a very simple operation but Excel just
ignores the instuctions i.e Dim Rw As Integer
Rw = 2
TextBox1.Text = Sheet1.Cells(rw,1)
Any help will be appreciated.



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
populate cell on worksheet 2 if text is red on worksheet 1 SCrowley Excel Worksheet Functions 14 May 15th 07 09:28 PM
Best way to populate worksheet from 2 combo boxes jswasson Excel Worksheet Functions 0 July 7th 06 01:21 PM
INDEX/MATCH formula in VBA to populate text boxes Amber_D_Laws[_73_] Excel Programming 14 February 17th 06 04:19 PM
Having data populate text boxes based on Combobox Value Todd Huttenstine[_2_] Excel Programming 1 November 10th 03 01:35 AM
Populate Userform text boxes in VBA with VLookup data from #2 worksheet Laz[_2_] Excel Programming 4 October 8th 03 02:15 AM


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

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

About Us

"It's about Microsoft Excel"