Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Simple Question: Select Text Box from Spreadsheet?
I am stuck on what seems a very simple problem: I can't select a textbo that is in a spreadsheet. The textbox is called Text Box 125 (at least that's what appears in th top left corner, where it usually displays cell name like "J8"). I want to delete this textbox if a cell is empty. My difficulty is i selecting the box. I have tried things like: TextBox125.Select TxtBox125.Select Text_Box_125.Select What am I doing wrong? Thanks! -- Lost ----------------------------------------------------------------------- Lost!'s Profile: http://www.excelforum.com/member.php...fo&userid=2399 View this thread: http://www.excelforum.com/showthread.php?threadid=37711 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Simple Question: Select Text Box from Spreadsheet?
Excel ranges have a "select" method, Textboxes don't. You can, however
approach it other ways: Me.TextBox125.Delete or ActiveSheet.Shapes("TextBox125").Delete HTH, -- George Nicholson Remove 'Junk' from return address. "Lost!" wrote in message ... I am stuck on what seems a very simple problem: I can't select a textbox that is in a spreadsheet. The textbox is called Text Box 125 (at least that's what appears in the top left corner, where it usually displays cell name like "J8"). I want to delete this textbox if a cell is empty. My difficulty is in selecting the box. I have tried things like: TextBox125.Select TxtBox125.Select Text_Box_125.Select What am I doing wrong? Thanks!! -- Lost! ------------------------------------------------------------------------ Lost!'s Profile: http://www.excelforum.com/member.php...o&userid=23990 View this thread: http://www.excelforum.com/showthread...hreadid=377116 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Simple Question: Select Text Box from Spreadsheet?
You are asking about selecting the textbox, which is one thing, and deleting
it if a cell is empty. I'm not sure exactly what it is you want to do but I'll do my best to describe how to do these things. To "select" the textbox I presume you mean you don't want the cursor to go there to type in something. You need to be in design mode. On the menu bar do View--Toolbars--Control Toolbox. When the window opens click on the button with the blue triangle and pencil. Now you can click on the textbox to select it. Press the Delete key to permanently delete the textbox. If this is not what you want to do, maybe you mean you want to hide the textbox (make it invisible) when a particular cell is empty. In the Worksheet_Change sub you can do something like this: TextBox125.Visible = Range("A1").Text < "" "Lost!" wrote: I am stuck on what seems a very simple problem: I can't select a textbox that is in a spreadsheet. The textbox is called Text Box 125 (at least that's what appears in the top left corner, where it usually displays cell name like "J8"). I want to delete this textbox if a cell is empty. My difficulty is in selecting the box. I have tried things like: TextBox125.Select TxtBox125.Select Text_Box_125.Select What am I doing wrong? Thanks!! -- Lost! ------------------------------------------------------------------------ Lost!'s Profile: http://www.excelforum.com/member.php...o&userid=23990 View this thread: http://www.excelforum.com/showthread...hreadid=377116 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Simple Question: Select Text Box from Spreadsheet?
Thanks very much for the replies. First of all, I should mention that I am using Excel 2000. I was unclear. When I said I want to 'select' the box, I meant I want it to appear is if I had clicked on the border of the box and it was selected so that I could press the delete key and get rid of the box. I didn't mean that I want to have the cursor appear in the textbox itself. The only reason I want to select the box is to delete it after, so if this step can be skipped (as it appears from your replies), great! Also, I want to make it clear that the textbox to be deleted (or hidden) is in one of the tabs of my spreadsheet. It is NOT in VBA. The textboxes on my userforms are completely separate from the ones on the spreadsheet. These textboxes were added by someone else because she wanted it formatted differently. Unfortunately, neither of these solutions worked for me. I must be putting the code in the wrong place. When I tried the "TextBox125.Visible = Range("A1").Text < """ in the Worksheet_Change Sub, I got an error. Also, I can't seem to get the "ActiveSheet.Shapes("TextBox125").Delete " code to work. I am trying to put it in the code that activates upon clicking a command button. Thanks!! P.S. Let me add that hiding the box is preferable to deleting it. -- Lost! ------------------------------------------------------------------------ Lost!'s Profile: http://www.excelforum.com/member.php...o&userid=23990 View this thread: http://www.excelforum.com/showthread...hreadid=377116 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Simple Question: Select Text Box from Spreadsheet?
"Lost!" wrote: I was unclear. When I said I want to 'select' the box, I meant I want it to appear is if I had clicked on the border of the box and it was selected so that I could press the delete key and get rid of the box. That's what I thought you meant. You need to be in Design Mode to select the textbox as you mention. Then click on the textbox and press the delete key. George's method should work too, but you may need to specify the sheet by name like this: Sheets("Sheet1").Shapes("TextBox125").Delete But if you aren't creating and deleting controls on-the-fly, just going into Design Mode to get rid of it is easiest. The only way I know to get into Design Mode is through the View menu. View--Toolbars--Control Toolbox. There should be a button with a blue triangle to toggle in and out of Design Mode. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF formula-simple question; simple operator | Excel Discussion (Misc queries) | |||
Simple Simple Excel usage question | Excel Discussion (Misc queries) | |||
Simple scroll and select? | Excel Programming | |||
simple question, hopefully a simple answer! | Excel Programming | |||
Very simple Select problem? | Excel Programming |