Solved

Userform Textbox Default Value, pointing to a specific Workbook>Tab> and cell?

Posted on 2013-06-28
3
742 Views
Last Modified: 2013-07-02
This might be an easy one.

I am using a userform that I want to grab a specific cell text value from.  How would I tell Excel to grab the text value of WorkBook1, Sheet2 and cell b4?  Needs to be formatted as text.

Please advise and thanks. -R-
0
Comment
Question by:RWayneH
3 Comments
 
LVL 2

Accepted Solution

by:
arildj78 earned 250 total points
ID: 39285922
In Visual Basic Editor, create label1 on your userform and doubleclick the userform. The editor should appear so you can insert the following method.

Private Sub UserForm_Activate()
    Label1.Caption = Sheet2.Range("B4").Value
End Sub

Open in new window


When the form is activated this method will fire and the value in B4 is used as text in the label. If you are using a textbox you should replace Label1.Caption with TextBox1.Text.

If you would like to trigger the transfer of text on something else then the activation of the userform, you can select different events from the dropdown list in the upper right corner when editing code.
0
 
LVL 80

Assisted Solution

by:byundt
byundt earned 250 total points
ID: 39286149
To capture a cell value from another open workbook and format it as a Social Security number, you might do it like this:
Private Sub UserForm_Initialize()
TextBox1.Value = Format(Workbooks("YTD-TotalsQ28170943.xlsm").Worksheets("6-Apr-2013").Range("C15").Value, "000-00-0000")
End Sub

Open in new window

)
0
 

Author Closing Comment

by:RWayneH
ID: 39294888
Both responses worked.  Thanks  and EXCELent!!  -R-
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now