Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import Cell format in userform textbox 2

Status
Not open for further replies.

ckhunley

Technical User
Jul 26, 2004
33
US
I have macro which uses a combobox to filter a database based on criteria in the first column. I want to then pull the info from the remaining columns into text boxes on the user form, so that the user can alter any of the entries (such as number of parts) before I paste that entry into another worksheet. I have been able to pull the text from the appropriate cell, but is there a way to get any associated formatting (such as color, border, etc.) so that it will match up when it is pasted into the new workbook. (I have certain values highlighted in the database which should not generally be changed, and want this to be shown on the userform.)
Thanks
Chris
 
This uses some cell properties to format a text box :-

Code:
Private Sub CommandButton1_Click()
    Dim MyCell As Range
    Set MyCell = ActiveSheet.Range("A1")
    Me.TextBox1.BackColor = MyCell.Interior.Color
    Me.TextBox1.ForeColor = MyCell.Font.Color
    Me.TextBox1.Font.Bold = MyCell.Font.Bold
End Sub

Regards
BrianB
Use CupOfCoffee to speed up all windows applications
================================
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top