ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy text from cells into different textboxes (https://www.excelbanter.com/excel-programming/408573-copy-text-cells-into-different-textboxes.html)

JazzyXXL

copy text from cells into different textboxes
 
hi all,
I am a beginner concerning VBA scripting and I have following task:
I have got a flowsheet diagram of a process drawn in Excel. Further,
Excel calculates the single streams of the process (mass flows and
concentrations). This data is written into several cells in the
worksheet. What I want to do is to automatically update the values
from the cells into textboxes that are attached to the flowsheet
diagram. The problem I have is that I do not know how to address the
existing textboxes with VBA. Could somebody give me a hint?
Thanks,
Luca

JLGWhiz

copy text from cells into different textboxes
 
Assuming the TextBox is from the Control ToolBox. As an example:

Sheets(1).TextBox1.Text = Sheets(1).Range("A1").Value

Would place the data in Cell A1 into TextBox 1.

"JazzyXXL" wrote:

hi all,
I am a beginner concerning VBA scripting and I have following task:
I have got a flowsheet diagram of a process drawn in Excel. Further,
Excel calculates the single streams of the process (mass flows and
concentrations). This data is written into several cells in the
worksheet. What I want to do is to automatically update the values
from the cells into textboxes that are attached to the flowsheet
diagram. The problem I have is that I do not know how to address the
existing textboxes with VBA. Could somebody give me a hint?
Thanks,
Luca


JazzyXXL

copy text from cells into different textboxes
 
Okay. But how do I address the textboxes? I have to set the variable
TextBox1 somehow and link it to one of the several textboxes spread on
the worksheet. That's actually my main problem...


JLGWhiz

copy text from cells into different textboxes
 
TextBox1 is an Object Name, not a variable. But maybe if you explained what
you are trying to do, it would help to determine a better solution.

"JazzyXXL" wrote:

Okay. But how do I address the textboxes? I have to set the variable
TextBox1 somehow and link it to one of the several textboxes spread on
the worksheet. That's actually my main problem...



JazzyXXL

copy text from cells into different textboxes
 
I'll try to explain in more detail what I plan to do.
I have got a table like the following containing the composition of
several streams in a chemical process:

component stream 1 stream 2 stream 3 ...
COMP1 1 t/h 0.2 t/h ....
COMP2 0.5 t/h ....
COMP3 2 t/h ....
....

Further I have a flowsheet of the process as for example shown he
http://de.wikipedia.org/wiki/RI-Flie%C3%9Fbild.

What I want to do is to draw textboxes for each stream into this
flowsheet and copy the content from the table into the respective
textbox.

Since I will run several simulations I would like to update the data
in the textboxes without having to redraw and replace them.
A sub or function of this type would be nice:

update_textbox(textbox_ID As WhatEver, cells_to_copy_into_textbox As
Range)

Thanks for suggestions

Luca


All times are GMT +1. The time now is 05:00 PM.

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