Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default keeping an object in view

I have written this code which works fine but i would like to know if it is
possible in some way to have the code execute but not lose the combo box
while the code darts back and forth across the sheet.

Private Sub ComboBox5_LostFocus()
' runs when combo box loses the focus
If Range("AP9") = False Then
With Worksheets("INPUT DAMAGE")
.Range("D2").Copy
.Range("AP12").Offset(rowOffset:=Range("AP10"), columnOffset:=0) _
.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
.Application.CutCopyMode = False
.Range("AP13").sort Key1:=Range("AP14"), Order1:=xlAscending,
Header:=xlGuess _
, OrderCustom:=2, MatchCase:=False, Orientation:=xlTopToBottom
End With
Range("A1").Select
End If
End Sub

Thanks in advance, Nigel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default keeping an object in view

Hi Nigel,

Not quite sure what exactly your asking for here but if you want to
stop the code 'flashing' then use

Application.ScreenUpdating = False

however because the code is triggered when the combobox looses focus
it cant be guaranteed that it will be in view while the code is
running as the user could simply select a different sheet!

If you are a bit more sprecific l am sure we can help

HTH

Michael

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default keeping an object in view

Hi Michael

Ok. The combo box is one of many and i was hoping that the page would not
scroll right and down to the location of the list while the code is running,
enabling the user to make selections in other combo boxes without waiting for
the code to finish.
It will also look more professional if the sheet remains static.

Thanks Nigel

"michael.beckinsale" wrote:

Hi Nigel,

Not quite sure what exactly your asking for here but if you want to
stop the code 'flashing' then use

Application.ScreenUpdating = False

however because the code is triggered when the combobox looses focus
it cant be guaranteed that it will be in view while the code is
running as the user could simply select a different sheet!

If you are a bit more sprecific l am sure we can help

HTH

Michael


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default keeping an object in view

Hi Nigel,

inserting :

Application.ScreenUpdating = False

as your 1st line of code will stop that movement for you whilst the
code is running. Depending on which version of Excel you are running
it is set back to True when the procedure ends. Your curent code
selects cell A1 so that will be the cell selected cell when the code
ends, perhaps you could change this so that the next combo box is
selected?

HTH

Michael
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default keeping an object in view

Hi Michael

It works great thankyou. Thats a great idea but how do i get the next combo
box to take the focus?

Many thanks Nigel

"michael.beckinsale" wrote:

Hi Nigel,

inserting :

Application.ScreenUpdating = False

as your 1st line of code will stop that movement for you whilst the
code is running. Depending on which version of Excel you are running
it is set back to True when the procedure ends. Your curent code
selects cell A1 so that will be the cell selected cell when the code
ends, perhaps you could change this so that the next combo box is
selected?

HTH

Michael



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default keeping an object in view

Hi Nigel,

Something like this:

Sub cbxFocusTest()
ActiveSheet.combobox1.Activate
End Sub

HTH

Michael
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 turn off Page Layout View as default view Colin Halliday New Users to Excel 3 October 12th 07 02:37 AM
Keeping column name in view when scrolling Geoman Excel Worksheet Functions 2 July 27th 07 05:44 AM
How do I view color onscreen (it shows up in print view only) janice Excel Discussion (Misc queries) 1 August 15th 06 07:32 PM
keeping a range a range object Eric Fingerhut[_3_] Excel Programming 1 July 9th 06 02:42 AM
should be possible to view entire MS Word embedded object in MS E. Phillip M. Feldman Excel Discussion (Misc queries) 1 April 21st 05 01:21 PM


All times are GMT +1. The time now is 11:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"