An Object Code= Flickers The Screen

Nov 27, 2009

way i could stop my sheet from flickering everytime i change my cell selection via keyboard/mouse. i checked and this problem is only with code below that i run in view code of my sheet...

PHP

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim str As String
Dim cboTemp As OLEObject
Dim ws As Worksheet
Set ws = ActiveSheet
On Error GoTo errHandler

If Target.Count > 1 Then GoTo exitHandler
If Target.Address(False, False) = "Z3" Then
    Call GoToMatch
    Exit Sub
End If

View 9 Replies


ADVERTISEMENT

Query Tables And Screen Flickers

May 9, 2012

No, this is not about ScreenUpdating = True/False

Neither is it because you've turned SU off, and then used 'Select' or 'DoEvents' etc in your code.

When running an update for a QueryTable (once a second), 3 'buttons' (activeX image controls with code behind them) flicker - though I see no reference to selecting and/or screenupdating in my code

Is this purely something about refreshing a querytable that I can't fix?

Is there a subclass or API call I can intercept to stop drawing the images alone?

Code:

Public Sub ActivateConn()

Dim strFilespec As String
Dim strConn As String
Dim sqlStr As String

Set RecSet = New ADODB.Recordset

[Code] .....

In short, there's no REASON why I couldn't just use the selection_change event to fire the same macros as the buttons but... well... it doesn't look anywhere near as good (I have a thing about making VB apps look as good as the code behind them is smart)

View 9 Replies View Related

Screen Flickers On Selection Change Event?

Mar 9, 2012

My screen flickers when I use the following code.

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim WTH As Long
If Target.Row = 19 Then
WTH = 1
End If
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
If I comment out the code, my screen doesn't flicker.

In the "Tmp = 1" line I was using the special cells method to color constants red (without selecting anything). When I use that code instead of the "Tmp=1" line, it takes about a second to change cells, and I see the "4 Processors Calculating Message" in Excel when the code fires--even if it's not in row 19.

View 6 Replies View Related

Code Affects Screen Display!

Mar 2, 2009

I use the following piece of code to Hide/Unhide columns as required by a specific worksheet.

View 4 Replies View Related

Code To Position Sheet On Screen

May 29, 2012

I'm using a bit of code (below) which is not amazing but which does seem to work, the idea being that entering a number then the active cell relating to that number will be highlighted and the sheeet position will "goto" it to move it into view on the screen. I have adapted this from something in one of my old Workbooks, and I admit it's probably a bit messy!

The problem is, it doesn't seem to always put the returned active cell in the same place, sometimes it's nicely central to the screen, but at others it's right at the top. As the numbers corrrespond to the top line of each little area of 30 rows, I'd like it to to come about 10-12 rows down. I can't seem to get this to work!

Code:
Sub FindSection()
Dim nm As Integer, txtnum As String, Found As Range
txtnum = Application.InputBox(prompt:="Enter a Number")
Set myRange = Worksheets("T&M SHEET").Range("K:K")

[Code]....

View 5 Replies View Related

VBA Code For Full Screen With Save As

Aug 21, 2013

i have an excel workbook containing approx 20 worksheets. What I would like to do is make the workbook go full screen when the user opens the file and allow the user to save as into the same file path the workbook is stored when closed

View 2 Replies View Related

Delete Splash Screen UserForm & Code

Sep 4, 2006

Some time ago (not sure how long ago) I created a splash screen that comes up when I first load a particular workbook. There was only one worksheet in the workbook and at that time the data in the worksheet was not so relevant and hardly ever used. That workbook name is "Employees" and the worksheet name is "EmpData".
Subsequently, the worksheet ("EmpData") in the workbook "Employees" has became relevant to a new workbook named "Payroll" I created. This workbook is used all the time. It had four different active worksheets.

I realized last week that the data in "EmpData" was very relevant to the work in the "Payroll" workbook so I copied "EmpData" worksheet in it's entirety to the "Payroll" workbook as a fifth worksheet using the same name as before, "EmpData". Now each time I open the "payroll" workbook the splash screen shows up and hangs around for several seconds or longer. It has become quite irritating and I want to delete it.

View 3 Replies View Related

Running Simple VBA Code Causing Screen Errors

Nov 30, 2009

I have a rather large workbook (30 sheets, 10MB) that has one worksheet with many INDIRECT functions in it (pulling data from the same file, different tabs). I am working to put simple code into the workbook to protect and/or unprotect all worksheets. I have gotten code to work to both protect and unprotect all the sheets, but when I run the unprotect code (see below), and then I go to edit the workbook, data from the sheet with many "indirect" functions temporarily "overwrites" the data on the active sheet (this is fixed when I scroll my mouse over the effected cells). I am developing this workbook for other users, so I'd like to fix this before sending it off to them.

This problem does not happen until after I run the following .....

View 14 Replies View Related

Mouse Click Freezes Screen - Code Still Executes

Jun 16, 2006

it would be possible to have text disappear after being displayed in Excel for a while.

My son and I played around with games (helping create a photographic memory, I told the youngster!) on the thing and until yesterday neither of us noticed that clicking the mouse anywhere (actually just clicking it) causes the screen to "freeze" while the code still happily erases the text in the background.

Hitting ESC allows the screen to cath up to the actual code EVEN THOUGH the ESC key is actually disabled from breaking the code.

View 9 Replies View Related

Code To Insert Object?

Feb 9, 2007

Is it possible to use VBA to call an existing Excel function? I want to have code that calls up the "Insert - Object" popup window in the same manner as it would if the user clicked the toolbar.

View 2 Replies View Related

Copy Code In ThisWorkbook Object

Dec 9, 2009

I'm trying to copy all the sheets into a new workbook but the following code does not copy the workbook object called "ThisWorkbook", it does copy ALL the other sheets however.....


ActiveWorkbook.Sheets.Copy after:=Workbooks(fileDst).Sheets(1)

The "ThisWorkbook" object appears at the end of the list names "Microsoft Excel Object" after all the sheets are listed in the VBA project explorer, like this.....


Microsoft Excel Object
<icon> Sheet2(Sheet2)
<icon> Sheet2(Sheet2)
<icon> Sheet2(Sheet2)
<Excel icon> ThisWorkbook

I have code in there that is needed such as Workbook_Open() so it's needed when I copy to a new file or I have to hand copy it everytime.

View 11 Replies View Related

Optimise Repeated Code For Object

Aug 15, 2006

A while ago I was playing with an excel balanced scorecard which used various on change events of the cells to change the colour of an object (circle). Recently I have been looking at this again and have learned that I can lose some of the .select tags to improve & reduce the code. What we have now is 20 different PI's, each with an oibject assigned, called 'PISHAPE1' through to 'PISHAPE20'. Originally, the code checked every single controll cell, which could be either red, amber, green or no data, which would be black.

What I have works but I am sure there is a more efficient method, rather than repeating the case red, amber, green etc. The first part of the code is repeated 20 times for the different objects, just changing the shape number.

Dim cel As Range
For Each cel In Range("controlcell1").Cells
Select Case cel.Text
Case "Red"
ActiveSheet.Shapes("PISHAPE1").Fill.ForeColor.SchemeColor = 10
Case "Green"
ActiveSheet.Shapes("PISHAPE1").Fill.ForeColor.SchemeColor = 3
Case "Amber"
ActiveSheet.Shapes("PISHAPE1").Fill.ForeColor.SchemeColor = 51
Case "No Data"
ActiveSheet.Shapes("PISHAPE1").Fill.ForeColor.SchemeColor = 0
'etc.
Case Else
End Select
Next

SO following on from above, the next code for PISHAPE2 is as follows:........................

View 6 Replies View Related

Formula Reference In Object Without Code

Aug 14, 2007

Is it possible to make a textbox or combobox the reference of a formula in a cell?
I know that you can just do this on VBA, but if possible I don't want to do that in this particular case.

View 6 Replies View Related

Ensure Code Understands Object It Should Relate To

Aug 14, 2008

I have written some code that copies certain cells from a spreadsheet constructed form back to a master spreadsheet database. The idea being to prevent users of the form from accessing the database and mucking it up. I write it the long way round and am now trying to modify it to not have to open and close the database everytime BUT whenever I change it I get errors that I think relate to the code not understanding the change of object...

' 3. send updated data to the database (all yellow boxes will update)

' set parameters for cells to copy from
Dim r As Long, e4 As Long, e6 As Long, e18 As Long, e20 As Long, e22 As Long, e24 As Long, _
e26 As Long, e28 As Long, e30 As Long, e32 As Long, e34 As Long, e36 As Long, e38 As Long, _
e40 As Long, e42 As Long, e44 As Long, e46 As Long
r = Range("D2")
e4 = Range("B4")
e6 = Range("B6")
e18 = Range("B18")
e20 = Range("B20")
e22 = Range("B22")
e24 = Range("B24")

The little blocks of code go on for 17 open/closes!

View 4 Replies View Related

Object Variable Error With Code For Solidworks

Jul 11, 2007

I recently wrote the following macro to drive several dimensions in a Solidworks assembly using cell values in excel. The strange thing is that I witnessed the macro work on several occassions with the exact same code, however now it always produces "Run-time error 91: Object variable or With block variable not set". I read in another forum that macros in excel can become fragmented with repeated editing, and unloading all the macros then loading everything back up again actually worked for a little while, however I would rather fix an issue with the code if there is one:

Note: In Debug mode the lines

Part.Parameter("D1@Sketch1@CORE INNER.Part").SystemValue = _
Sheets("AEM Core and No Load Loss").Range("B4").Value / 1000

are highlighted

Sub Generate_Core()
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
Part.Parameter("D1@Sketch1@CORE INNER.Part").SystemValue = _
Sheets("AEM Core and No Load Loss").Range("B4").Value / 1000
Part.Parameter("D2@Sketch1@CORE INNER.Part").SystemValue = _
Sheets("AEM Core and No Load Loss").Range("B5").Value / 1000................

View 3 Replies View Related

Identify Object That Triggered Macro Code

Feb 27, 2008

I need to identify the object that is triggering the current running macro. For example, i have 4 buttons say button 1 to 4 that all do almost the same thing. I have written 4 different macro for all 4 buttons but i want to simplify my code so that i can have a better leaner code by only using 1 macro for all 4 buttons. simply put is there a way to say identify which button/shape i pressed:

If "identity of button pressed" = "Button1" Then
execute some code
Else
End If

View 3 Replies View Related

Application Onkey: Prevent Users From Using The Print Screen Or The Alt Print Screen Buttons On The Keyboard

Dec 29, 2009

I'm just looking to prevent users from using the print screen or the alt print screen buttons on the keyboard. I have this script that works if I use "39" (Right Arrow)but wont work if I use "42" (Print Screen Button).

View 5 Replies View Related

Object Defined Error When Code In Workbook Open Event

Sep 7, 2007

I have a macro that checks if a username is in a particular list, and if it is, it unhides certain sheets in the workbook.

The code runs fine if I just run it as a macro or off a command button, but I am trying to execute it when the workbook opens and I keep getting a 57121, Application defined or object defined error.

The code is below;

Private Sub Workbook_Open()

DoEvents

Dim Res1 As VbMsgBoxResult
Dim GovRng As Range

For Each GovRng In Sheets("Map").Range("GovernanceMembers")
If GovRng.Value = Application.UserName Then Goto 111
Next GovRng

Exit Sub

View 6 Replies View Related

Cmd Button Code To Display Video In Windows Media Player Object In Spreadsheet

Apr 22, 2009

I have a sample spreadsheet (uploaded to this thread) in which I have 10 command buttons named 'Video 1' to 'Video 10'. Next to these buttons is a Windows Media Player Object.
I require the code that upon clicking any of the video command buttons, the relevant video is opened and shown in the windows media object within the same sheet (sheet1).

I'm sure the code for each button will be the same apart from the cmd button reference number/name and the link to the file to be played.

If we assume all the videos are called as per their buttons i.e. Video 1.wmv, Video 2.wmv ... Video 10.wmv; and the location of these files is under 'C:Films', can someone post up some code for button 'Video 1' making it clear which variables to change for linking to the different files.

View 6 Replies View Related

Object Library Invalid Or Contains References To Object Definitions

Jan 17, 2005

I'm getting the following error:

"Object library invalid or contains references to object definitions that could not be found"

I wasn't getting that error last night and I'm not sure what I may have done to cause this error.

It seems to be cause by code running on one sheet of my workbook, but I'm not really sure about that. I'm still a bit of a novice at VBA.

I'm using Excel 2002 SP3 and I'm running MS XP Home as my OS.

Do you have any ideas what can cause this error and/or how to trace down the offending objects/code?

View 9 Replies View Related

Find Method Code: Object Variable Or With Block Variable Not Set

Sep 8, 2006

I need my program to:
- find the cell containing the string "Datum/Tid"
- record the column and the row of the found cell in two variables lCol and lRow

Here is my

Sub test()

Dim rFoundCell As Range
Dim lRow As Long
Dim lCol As Long

'Find method of VBA
Set rFoundCell = Range("A1")
Set rFoundCell = Worksheets("Sheet1").Range("A1:Z50").Find(What:="Datum/Tid", After:=rFoundCell, _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)

'for anyof the two lines down I get the message "object variable OR block variable not set"

lRow = rFoundCell.Row
lCol = rFoundCell.Column

End Sub

View 5 Replies View Related

Application Defined Or Object Defined Error In Code

Apr 26, 2006

I am getting an 'application defined or object defined' error at the code coloured red. I'm trying to sort a list of names starting at c5


'Update Names on Sheets
If Sheets("Daily Visits May").Range("e1") = "y" Then Goto 10
If Sheets("Daily Visits May").Range("d1") > 38837 Then Else Goto 10
Sheets("Daily Visits Apr").Select
Range("b5:c660").Select
Selection.Copy
Sheets("Daily Visits May").Select
Range("b5").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Sort Key1:=Range("C5"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

View 3 Replies View Related

Pivot Chart Object: Find Any Suitable Object To Choose From To Make A Pivot Chart In Powerpoint

Mar 21, 2007

1) i have office 2003 on a laptop. within powerpoint, i can create a 'microsoft excel chart 11' object. to create a link to the excel data source, do i have to go through the odbc sql setup? it works, but i don't want my powerpoint to be dependent on some excel file somewhere. what are the other options to insert/make a functional pivot chart in powerpoint with the data also within powerpoint? the data as sheet option does not result in the chart being a pivot, it's just a plain chart. it has to be a proper object, not an image paste or a chart that updates links with the excel file open.

2) i have office 2007 on my other laptop. i can not find any suitable object to choose from to make a pivot chart in powerpoint. what's the best way to go about in 2007 version?

3) am i going about this the wrong way with the objects? should i be after vba code?

View 4 Replies View Related

VBA Code Error '1004' "Application-defined Or Object -defined Error"

Sep 18, 2009

In one worksheet i have created the following code, which adds date to
specific column when data is entered in colum A.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column = 1 Then
Target.Offset(0, 10).Value = Now()
End If
End Sub

The problem is that when trying to delete a whole row, error message pops-up.
Run-time error '1004' Application-defined or object -defined error. When click "End" actually everthing is ok, the row has been deleted, but was just wondering what is causing that error.

View 2 Replies View Related

2003 Is Too Far Up On The Screen

Sep 27, 2009

I did the restart our company required and when Excel reopened it was on my laptop rather than the big screen. I run 2 screens. Excel 2003 is now so far up on the laptop screen, I cannot move it. I can barely see File, Edit, View, etc. How can I drag Excel down so I can resize it?

View 4 Replies View Related

Screen Size

Dec 7, 2009

what size monitor do you use?

I'm thinking about upgrading my 17" to a 23" monitor so I can see more cells without zooming

Anyone currently use a 23" for Excel?

View 14 Replies View Related

Screen Position

Aug 18, 2009

I would like to end a macro with a specific cell (e.g. E50) in the first cell in the upper left hand corner of the screen. How might I accomplish this?

View 3 Replies View Related

Can't Get Screen To Go All Way To Top Of Page

Nov 21, 2011

I cant get my screen to go all the way to the top of the page! & there is a 2 inch or so area at the bottom of the worksheet as well. I need to get my display back to normal!

View 4 Replies View Related

Print Screen

Jul 6, 2007

macro minimizes excel takes a print screen of the application behind excel then pastes it in a word document then maximizes excel screen again

View 9 Replies View Related

Splash Screen

Nov 22, 2008

I have never created a splash screen and would like to do so now, I am in the VB editor, i have inserted a userform, i would like to insert my company logo on to the userform, how do i do this?

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved