Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Referencing a Defined Name

Below is a snippet of code I use to place data from a userform onto a
worksheet and to return a value to the userform.

I am recreating my worksheet and am using Defined Names for many of the
cells. I want TextBox1.Text to be placed in Start_1, TextBox2.Text to be
placed in End_1.

Start_1 is defined as a range AV3 through AV36. Not sure if that is
important or not. But of course if I am on row 12 I want the
data in TextBox1 (TextBox1.Text) to be placed in the start_1 on row 12.

So can I reference the defined name and achieve the same result.



TextBox1.Text = rng(1, 47).Text
TextBox2.Text = rng(1, 48).Text
TextBox3.Text = rng(1, 50).Value
TextBox3.Text = Format(TextBox3.Text, "0.0")
TextBox4.Text = rng(1, 53).Text



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 296
Default Referencing a Defined Name

On Thu, 23 Dec 2004 18:08:13 -0800, "Patrick Simonds"
wrote:

Below is a snippet of code I use to place data from a userform onto a
worksheet and to return a value to the userform.

I am recreating my worksheet and am using Defined Names for many of the
cells. I want TextBox1.Text to be placed in Start_1, TextBox2.Text to be
placed in End_1.

Start_1 is defined as a range AV3 through AV36. Not sure if that is
important or not. But of course if I am on row 12 I want the
data in TextBox1 (TextBox1.Text) to be placed in the start_1 on row 12.

So can I reference the defined name and achieve the same result.



TextBox1.Text = rng(1, 47).Text
TextBox2.Text = rng(1, 48).Text
TextBox3.Text = rng(1, 50).Value
TextBox3.Text = Format(TextBox3.Text, "0.0")
TextBox4.Text = rng(1, 53).Text


Conceptually: you could read the active cell row and column number and
use this in a range.cells(row,col) piece of code attached to the click
or change event of the text box.

Rgds








__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Referencing a Defined Name

By using the Defined Name I would not have to go in and edit all the
references when it became necessary to add a column.


"Richard Buttrey" wrote in
message ...
On Thu, 23 Dec 2004 18:08:13 -0800, "Patrick Simonds"
wrote:

Below is a snippet of code I use to place data from a userform onto a
worksheet and to return a value to the userform.

I am recreating my worksheet and am using Defined Names for many of the
cells. I want TextBox1.Text to be placed in Start_1, TextBox2.Text to be
placed in End_1.

Start_1 is defined as a range AV3 through AV36. Not sure if that is
important or not. But of course if I am on row 12 I want the
data in TextBox1 (TextBox1.Text) to be placed in the start_1 on row 12.

So can I reference the defined name and achieve the same result.



TextBox1.Text = rng(1, 47).Text
TextBox2.Text = rng(1, 48).Text
TextBox3.Text = rng(1, 50).Value
TextBox3.Text = Format(TextBox3.Text, "0.0")
TextBox4.Text = rng(1, 53).Text


Conceptually: you could read the active cell row and column number and
use this in a range.cells(row,col) piece of code attached to the click
or change event of the text box.

Rgds








__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________



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
Referencing Defined Names in Other Workbooks wx4usa Excel Discussion (Misc queries) 4 August 24th 12 05:21 PM
Run-time error '50290': Application-defined or object-defined erro Macro button Excel Discussion (Misc queries) 1 March 12th 09 10:59 AM
Referencing defined range spartanmba Excel Discussion (Misc queries) 2 September 14th 05 01:28 AM
Workspace faux user-defined type not defined Chris S[_2_] Excel Programming 3 November 11th 04 05:51 PM
Word.Document - user defined type not defined jowatkins[_7_] Excel Programming 0 January 20th 04 08:46 AM


All times are GMT +1. The time now is 12:08 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"