![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 1
|
I have created four macros each that will calculate selling price based on % of profit. I have created four text boxes and assigned a macro to each. I would like to highlight the textbox I chose last and have no highlight on the other 3. In other words only 1 text box would be highlighted at a time. Can anybody help me with how to do this. Thank you
[ This Message was edited by: gmg2291 on 2002-04-17 09:48 ] |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Denver, Colorado USA
Posts: 4,014
|
Hi gmg,
I am assuming your textboxes are Shape objects, not ActiveX control-type textboxes. Here is a macro which does what you describe. This macro assumes your textboxes are named "Text Box 1", "Text Box 2", etc., (the default naming convention). Simply call this macro from within each of the macros that you have assigned the textboxes to. Sub HiLite() 'Highlights TextBox called from and un-highlights all others Dim Sh As Shape For Each Sh In ActiveSheet.Shapes If Sh.Name = Application.Caller Then Sh.Fill.ForeColor.RGB = RGB(255, 255, 200) Else Sh.Fill.ForeColor.RGB = RGB(255, 255, 255) End If Next Sh End Sub
__________________
Keep Excelling. Damon VBAexpert Excel Consulting (My other life: http://damonostrander.com ) |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|