Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I use VBA to draw lines and dots on a control chart that consists of cells
border and color formats. When the code finishes, the last thing drawn is still "selected". So if I say, hit an arrow key, that dot or line is moved. I don't want that. I have 12 other people using this chart and I need predictable behavior. I tried adding to the end of the sub "Activecell.offset(0,1).activate" or "select" but the dot is still selected (ergo affected by the next keystrokes). If you hit the {ESC} key in Excel, problem solved, so you would think ... SendKeys "{ESC}" ... once or twice would do the trick, right? Nope, doesn't work. Help! Please, help. This is driving me nuts. -JayH |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Jay,
You didn't post your code so I'm going to assume that you are selecting the lines after you draw them. For example, you draw them like this: ActiveSheet.Shapes.AddLine(100, 100, 200, 200).Select You can draw lines without selecting them which should solve your problem. So, draw them like this: ActiveSheet.Shapes.AddLine 100, 100, 200, 200 -- Hope that helps. Vergel Adriano "jedihe" wrote: I use VBA to draw lines and dots on a control chart that consists of cells border and color formats. When the code finishes, the last thing drawn is still "selected". So if I say, hit an arrow key, that dot or line is moved. I don't want that. I have 12 other people using this chart and I need predictable behavior. I tried adding to the end of the sub "Activecell.offset(0,1).activate" or "select" but the dot is still selected (ergo affected by the next keystrokes). If you hit the {ESC} key in Excel, problem solved, so you would think ... SendKeys "{ESC}" ... once or twice would do the trick, right? Nope, doesn't work. Help! Please, help. This is driving me nuts. -JayH |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jay,
As noted, you don't need to select objects in your code to add them. Your suggestion (Activecell.offset(0,1).activate) should work, but you can always force a range selection: Dim mySel As Range Set mySel = Selection 'Other code here mySel.Select will return your sheet to its original selection. Otherwise, just select a specific cell: Range("A1").Select HTH, Bernie MS Excel MVP "jedihe" wrote in message m... I use VBA to draw lines and dots on a control chart that consists of cells border and color formats. When the code finishes, the last thing drawn is still "selected". So if I say, hit an arrow key, that dot or line is moved. I don't want that. I have 12 other people using this chart and I need predictable behavior. I tried adding to the end of the sub "Activecell.offset(0,1).activate" or "select" but the dot is still selected (ergo affected by the next keystrokes). If you hit the {ESC} key in Excel, problem solved, so you would think ... SendKeys "{ESC}" ... once or twice would do the trick, right? Nope, doesn't work. Help! Please, help. This is driving me nuts. -JayH |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Selecting Drawing Object By Name | Excel Programming | |||
Floating Drawing Object | Excel Programming | |||
Drawing Object in a Userform | Excel Programming | |||
Drawing Object | Excel Programming | |||
Drawing object references | Excel Programming |