Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Changing color in text boxes based on content

I have a spreadsheet with multiple cells and text boxes in some of the cells.
I want to be able to change the internal format of the cell based on the
information contained in the text box using a macro.

Also, is there a way to wrap the text box around the data in the cell like
the way Word can?

Any assistance would be appreciated.
oldybutgoody

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default Changing color in text boxes based on content

One way:

Public Sub CFTextBox1()
Dim nColorIndex As Long
Select Case Sheets("Sheet1").TextBoxes("Text Box 1").Text
Case "Option 1"
nColorIndex = 3
Case "Option 2"
nColorIndex = 5
Case "Option 3"
nColorIndex = 7
Case Else
nColorIndex = xlColorIndexNone
End Select
Range("A1").Interior.ColorIndex = nColorIndex
End Sub

Expand/change format to suit.

Your text boxes aren't "in some of the cells". Text boxes always exist
in the Drawing Layer in front of the cells. At best they can be
positioned to move and size with the underlying cells. XL can't wrap
text around them.

In article ,
oldybutgoody wrote:

I have a spreadsheet with multiple cells and text boxes in some of the cells.
I want to be able to change the internal format of the cell based on the
information contained in the text box using a macro.

Also, is there a way to wrap the text box around the data in the cell like
the way Word can?

Any assistance would be appreciated.
oldybutgoody

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
how to change a cell color based on its content using macro? Ranger888 New Users to Excel 6 December 15th 08 08:23 PM
Cond. format text color based on another's text color manxman Excel Discussion (Misc queries) 3 August 31st 06 06:27 PM
Changing background color based on different cell djarcadian Excel Discussion (Misc queries) 3 August 10th 06 10:44 PM
Changing color of single bar based on x-axis date value [email protected] Charts and Charting in Excel 2 August 4th 06 05:17 PM
Changing the color of a list entry based on a tolerance Blink Excel Worksheet Functions 1 July 15th 05 05:18 PM


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