Customizing Debug Pop Up Window

Aug 23, 2006

If a user decides to hit the esc key right in the middle of one of my procedures (bug free, etc), this will leave the file in an odd state. The file is set up so if the routine is re-run it cleans the file up and restores it to proper form.

But hitting esc exposes my code which is password protected when the file is idle. I employ a little trick that makes it hard to hack into my worksheet code, but one achilles heel is the esc button.

What I want is to have the file close if the routine is stopped in mid stream. This way the code is not exposed, and the user cannot monkey with the file.

I wanted to set the file up where i have a custom debug window that when a button is pressd the file closes OR when the user escapes out of the debug window the file closes as well.


Customizing Date Using Now

May 12, 2009

I'm trying to customize how my time gets display
Currently using,

View 3 Replies View Related

Prevent Toolbar Customizing

Sep 26, 2007

I want to restrict users from adding or removing toolbars from the workbook.
I have created a custom toolbar named xlUtilDemo1 which consists of 4 buttons that appear at the top of the screen. I was able to restrict the movement of the toolbar, yet the user still can click the down arrow of the toolbar or right click the toolbar to customize the toolbar (select other ones).

below is the code that creates the toolbar and buttons. can anyone tell me how to make the add or remove buttons and the customize toolbar option disabled?

Sub CreateBar()
Dim oBar As CommandBar
Dim oControl As CommandBarControl
Dim oControl2 As CommandBarControl
Dim oControl3 As CommandBarControl
Dim oControl4 As CommandBarControl

Set oBar = Application.CommandBars.Add

oBar.Name = "xlUtilDemo1"
oBar.Visible = True .......................

View 9 Replies View Related

Customizing A Formula In A Cell By Formatting

Sep 24, 2007

How to customize a format or a formula in a cell in order to :

multiply by 2 any edited value in the cell .

Ex: by entering the nbr 3 and clicking enter the cell will result nbr 6 .

View 9 Replies View Related

If Then = Debug

Sep 23, 2009

Why does this give me a debug error?

View 4 Replies View Related

Two Different Passwords Without Debug

May 9, 2008

I have a problem with a HUGE macro project I'm working on. The macro itself isn't huge, but it's being applied to about 10,000 files. The macro is updating information on three spreadsheets in each workbook, but the problem is that the password protection (and Macro in general) fails to unlock when the password was entered in UPPERCASE. So the password is "king" and/or "KING" depending on the sheet. There is no way of predicting which sheets will be caps and which will not, but it's frustrating when my macro stops every 5 files with an error because of a wrong password (even though it's always one of those two).

Is there an IF THEN statement or something that I can do so that the macro doesn't stall every 30 seconds to 2 minutes... I have 10,000 files to crawl through.

View 10 Replies View Related

Debug Error 13

Jun 22, 2009

I have a working Excel 2007 macro that accesses two worksheets. I then added a third worksheet and want to access it from the macro. I get a debug error 13 Type Mismatch when the macro tries to access the third worksheet. I know I need to add the third worksheet on a pop-up but I don't remember how to open it.

View 14 Replies View Related

Debug Statement

Dec 5, 2008

I am trying to put together an automation. I am having problem debuging the code. I am trying to have the automation autofilter with "Interior" and "Exterior" at column P. I am using a statement as follow to pick the cell that is showing at at second row each time after the autofilter ran. (the first row of Exterior and Interior are different) However, when i pick Exterior, the automation was able to locate the second cell after picking Exterior, but when I try Interior, then i will have a debug meesage.

Range("Q2:Q" & Cells(Rows.Count, 1).End(xlUp).Row).SpecialCells(12)(1).Select

The code that I used is as follow:

Sub Macro4()

' Selection.AutoFilter
Selection.AutoFilter Field:=15, Criteria1:="=*Fixture*", Operator:=xlAnd
Selection.AutoFilter Field:=16, Criteria1:="="
Range("P2:P" & Cells(Rows.Count, 1).End(xlUp).Row).SpecialCells(12)(1).Select
ActiveCell.FormulaR1C1 = _

View 9 Replies View Related

Debug :: I Get: Division By Zero

Dec 15, 2009

When I debug this script I get: division by zero!

In 3 lines over the debugging line, the script are writing out the variable "prosentref" as 1. Whatt can be wrong?

(the value in cell T8769 is 1)

Option Explicit
Sub optimaliseringDrift()
Dim Pgm1 As Integer
Dim Pgm2 As Integer
Dim PL As Integer
Dim lamda_gm1 As Double
Dim lamda_gm2 As Double
Dim deriv1 As Double
Dim deriv2 As Double
Const Pgm1_max As Integer = 200
Const Pgm2_max As Integer = 300
Const Pgm1_min As Integer = 45
Const Pgm2_min As Integer = 40
Const deltaP As Integer = 5

View 9 Replies View Related

Debug: Subscript Out Of Range?

May 29, 2009

trying to copy some records across from once sheet to another?

butt it keeps debugging?

any idea why.

i'd like to keep the user defined type because it's neat and is good practice for myself?

View 9 Replies View Related

Find Function Debug

Feb 15, 2007

What I'm doing in this script is taking a whole bunch of variables and pasting them into a seperate sheet "Checks" which will construct a cashiers check. The problem is where I've highlighted the code in red. At that point I have copied the Vendor name to the clipboard - I then go to the "Vendor Info" page and search for that Vendor name. If that name exists on the page it works perfectly...moving one column to the right, grabbing the Address Line 1 and dropping it into the check, then going back and grabbing the Address Line 2 and dropping it into the check. The problem is when that Vendor name doesn't exist in the "Vendor Info" page...I want it to just paste two blank cells into the check (because I obviously don't have the address info for that Vendor)...but instead it gives me an error:

Run-Time error '91':

Object variable or With block variable not set

Sub Checks()
' Checks Macro
' Macro recorded 2/14/2007 by Derek Minner
' Keyboard Shortcut: Ctrl+Shift+P
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _

View 3 Replies View Related

Debug.Print Cause Crashes

May 18, 2007

Continuing with my goal to learn VBA and while playing with the following code, I encountered strange behavior of debug statements. In the code below I have put my comments to identify where the "funny behavior" is encountered.

Will appreciate if you can help me understand. I also have a simple request/question at the end of the code below: ....

View 7 Replies View Related

Crash When Debug Addin

Jun 19, 2007

I am having a strange error occur. I am trying to debug a function in an add-in I developed, but whenever I try to hover over a value or add a watch, the whole application crashes. It runs without crashing when I don't try to debug it.

View 3 Replies View Related

Debug F8 Stopped Working

Jun 22, 2008

I recently got a new laptop. I now have excel 2007 and vista. The debug step key, F8, does not work. It toggles out of excel when pushed. If I start the procedure in the debug menu, the SHIFT - F8 will step through though. Is there a setting I am missing? It must have somehting to do with VISTA since in the debug section it says to use F8.

View 3 Replies View Related

Worksheet Before Save - Getting Debug Error?

Feb 12, 2014

I am trying to take the template I have created and after the information is entered, if all required is not filled in, it will highlight the cells that need filled in. I get a debug error on

Cell.Interior.ColorIndex = 6

And the file does not save elsewhere. It goes into never never land. Here is my whole code:

Option Explicit
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim Start As Boolean


View 5 Replies View Related

Debug Selection & Cash Register

Jun 7, 2009

I'm working on a sheet where I can specify sales by selection of month (Sheetname= ZoekenMaand).

Everything works fine for the months "januari" and "februari" (yes, it's in dutch ) but from "maart" it doesn't seem to work any more.

View 3 Replies View Related

Step Through & Debug VBA Macro Code

Jun 11, 2009

I don't understand the relationships that are happening and what the final value would be if for example the PT was Red. I'm confused and was curious how four lines could all equal different values(highlighted).

UpUserPaint = UCase(RegPaint.Value)
Dim icount As Integer
LenRegPaint = Len(RegPaint.Value)

For icount = 1 To LenRegPaint
ValPAint = ValPAint + Asc(Mid(UpUserPaint, icount, 1))
Next icount

If PTRed.Value Then
ColorCompare = Abs(Pallet * (ValPAint + PrdtSeed - LenRegPaint))
ColorCompare = Abs( Round(ColorCompare / PrdtSeed - 7227, 0))
ColorCompare = ColorCompare And 6215971
ColorCompare = ColorCompare Xor 6215971.............................

View 4 Replies View Related

Reading String Debug Kicking Out

Feb 3, 2007

I'm trying to create a macro that will send out emails to people based on an excel file that has 4 columns, nickname, purchased, owed, email address. I am able now to open the email, fill out to field, subject, body (mostly) and have it send if i change the code. The problem is kinda 2 part. I am trying to read in the amount owed cell (which is formatted to be $#.##) and then display that in the email, as well as reading in any other things and storing them to declared values. I am able to step through the code, but once it gets to the first part of reading in the nickname, it goes to the next line, you step through that, and then it immediately kicks out to the cleanup section. Below is the code... (Also, why is it that I need to set the row int to 1 insted of 2 (2 being where my data starts on the excel chart)).

Sub TestFile()

Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Dim row, purch, owed As Integer
Dim nick As String

row = 1
purch = 0
owed = 0

View 9 Replies View Related

Debug Function Called From Another File

Jun 26, 2007

I have a macro that calls functions from another workbook.

For example:

Private Sub Worksheet_Change(ByVal target As Range)
If ThisWorkbook.OpenCommon <> -1 Then _
Application.Run Workbooks("common.xls").name & "!Arkusz1.CellChange", target
End Sub

But when I get an error in CellChange function from "common.xls" workbook, debugger points only to the third line of the code above, not to the bad line in called function.
Is there any way to change this behaviour (maybe some tool etc.)?

View 5 Replies View Related

Debug Code & See Results As Stepping Through

Jun 15, 2008

When stepping through my macro it moves through each line of the code showing me the code as it steps through. Is there a way to step through and see the results of the code as it is going through. I have an "IF THEN" statement in the macro that is not giving me any results so I think I must have an incorrect reference in the code, but I can't see it. I think if I could watch what it is supposed to be doing as I step through I might be able to find the error.

View 4 Replies View Related

Macro Runs Fine In Debug But Not From ComboBox

Feb 24, 2009

I have a workbook that contains 9 worksheets. Four of the worksheets have the same row lables in column B and must always be the same. Three of the worksheets are fed from the 4th sheet so that the integrity of the lables is maintained.

The user can change the lable value to meet their needs and they can insert or delete rows (within limits) as they see fit.

The attached macro "Sub Delete_Row_All_Sheets()" works fine when I run it from Debug (F8).

However, when I run it from Forms.ComboBox the macro returns to the "y = Application.InputBox("Enter The Row Number You Wish To Delete", _" screen. If I select cancel, the results I anticipated occur but I don't want the user to have to assume this will happen.

Why does the macro return to this screen when executed from the ComboBox but not when executed from Debug?

View 14 Replies View Related

Using Call Module1.Offset = Debug Error

Sep 25, 2009

I created a long macro as follows with 2 Select Case structures and the macro works fine.

View 14 Replies View Related

Cannot Work Out The Debug With Copying Static Date

Nov 20, 2009

I'm trying to create vehicle maintenance inspection program for a mechanic at work. The trouble is the he's not fond of computer and I'm trying to make it as simple as possible. There's a debug in the line

View 2 Replies View Related

Selecting Variable Worksheets - Debug Error

Mar 19, 2012

I have below code which I was thinking is very simple to select variable worksheets. However I get Debug error when running:


Dim rng As Range
Dim cl
Set rng = Sheets("Budgetted sku's").Range("A2:A24")
For Each cl In rng

Next cl

View 5 Replies View Related

Code Works In Debug Mode But Will Not Run Through When Played

Mar 13, 2013

I put together about 10 separate macros that will log you into a site using the values in a given cell. I was having trouble with the last one because of AutoComplete remembering the username. So I put in an IF statement, and when I used F8 to go line for line, it works perfectly. However, when I click F5 and just let it play through, it doesn't log in. I tried adding a 5 second delay, but that didn't seem to work. I still get a run-time error when I hit play.

It get hung on this line:

If doc.getElementById("user_name").Value = cUsername Then

But the complete code is this:

Sub StreetLinks_Login()
'On Error Resume Next

Dim cURL As String
cURL = Worksheets("Sheet1").Range("B9").Value

[Code] ..........

View 7 Replies View Related

Macro Works In Debug Mode But Not In Runtime

Apr 7, 2008

I am trying to open a xls file and convert into csv. My macro works when I'm in debug mode. but If i run the macro (Not in debug) mode then After opening a file control is not going to next function. What is problem? Even I am not getting any error too

sub open file (FileName as string)

Dim xlx As Object, xlw As Object, xls As Object, xlc As Object
Dim RowNo As Integer
Set xlx = CreateObject("Excel.Application")
xlx.Visible = True
'Set xlw = xlx.Workbooks.Open(SourceFolder + "" + FileName)

Workbooks.Open FileName:=SourceFolder + "" + FileName
' Columns("F:G").Select
' Selection.Delete Shift:=xlToLeft
Save_in_WDrive (FileName)
Set xlx = Nothing
end sub

View 9 Replies View Related

Debug Assistance - Auto Date Entry

Apr 3, 2007

i try to lock cells in the area the VBA code affects. My goal is to actually have affected cells by this VBA code lock immediately after anything is entered in the affected cells. Area needing Debugging is in the If - Else portion. My worksheet will be protected.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim LLoop As Integer
Dim LTargetRange1 As String
Dim LDestRange1 As String
LLoop = 10
While LLoop <= 1000
'Link column B to A
LTargetRange1 = "B" & CStr(LLoop)
LDestRange1 = "A" & CStr(LLoop)
If Not Intersect(Range(LTargetRange1), Target) Is Nothing Then
If Len(Range(LTargetRange1).Value) > 0 Then
Range(LDestRange1).Value = Date
Range(LDestRange1).Value = Null
End If
End If
LLoop = LLoop + 1
End Sub

View 7 Replies View Related

Allow User To Enter Break Mode (Debug)

Jan 4, 2008

i want to do is throw a break in my vba code if the user selects yes through a msgbox vbYesNo prompt and proceed in debug mode. is it possible to code in a break point in this fashion? my desired pseudo

if user selects yes:
set break point (to send to debug mode at that point... i dont mean to end the code with a END statement.)
if user selects no:
proceed program normally

View 6 Replies View Related

Pasting Data Debug Error On A Sheet With Borders

May 1, 2009

I have code that selects and copies data from one sheet onto another sheet. the sheet that is getting data copied too has borders defined. When i run the code i get a debug error. Here is the issue.... when i remove all the borders it works fine. I have tried everything i can think of to solve the problem but have had no luck. anybody have an idea what is causing this. i attached the workbook file so you can see what is going on.

View 2 Replies View Related

Remove References Programmatically & How To Prevent Debug Error

Jun 19, 2009

i m working on an excel 2007 workbook with ms project functionality. in order to be able to use ms project from within excel i m using early binding. for those who dont know what early binding is:

this works fine if the user has ms project installed on his/her pc.

if the user does not have ms project installed i remove the broken references. this works fine.

but my problem is that when i remove the reference to ms project, my vba project will not compile correctly. thus each time when a user opens the workbook the user gets a "compile error in hidden module" , since the functions of ms project are not available.

for example i get a compile error in the following source
Public Function getResID(ResName As String, ActiveProject As Project) As Integer
Dim res As Resource
For Each res In ActiveProject.Resources
If = ResName Then
getResID = res.ID
Exit Function
End If
getResID = -1
End Function
i just want to know what i can do to prevent the compile error? would the use of late binding remove the problem? actually i dont want to use late binding since my source code is already very complex and it would be a huge effort to change it.

View 9 Replies View Related

OpenText Function In Macro Hangs Unless Stepping Through Code In Debug

Oct 29, 2009

We have had a macro running for a few years (Excel 2007 now, but started in 2003) that imports about 35 text files into separate sheets, creates a calculated SUM field for each sheet and copies that value to a title (or summary) sheet. We use this 2 to 4 times per year at inventory time, copying to a new file and deleting the old data before running the macro. The imported files initially create new workbooks, but the data is copied to the initial workbook into a distinct sheets for each file.

Recently (well, last August) this macro started hanging after importing (Workbooks.OpenText) a number of files, and not necessarily the same file every time (on repeated runs.) While trying to figure out the problem, I have now managed to get it to hang every time on the first file! However, if I am stepping through in the debugger it continues past the OpenText command and on F5:Run/Continue will then continue processing the rest of the files normally. If I delete the first file before running the macro, it then hangs on the second file instead.

Without debugging, the first file will import, display on-screen, and there it stops. If I put a break-point on the very next instruction after the import, that break-point is never reached. THINGS I'VE TRIED:.......

View 2 Replies View Related

Function Macro Debug: Continue Onto The Do Loop At The Bottom That Does All The Work

Aug 9, 2006

I am having a problem with a custom funciton I am trying to create. It will exit after it is finished with the IF Then Else statement. I need it to continue onto the Do loop at the bottom that does all the work.

Function UPCECheck( num As String) As Long
Dim CheckNum As Long
Dim TempCheck As Long
Dim X As Long
Dim Holdtxt As Variant
UPCECheck = 0
CheckNum = 0
Debug.Print Len(num)
If Len(num) = 12 Then
Holdtxt = num
ElseIf Len(num) < 12 Then
Holdtxt = "000000000000" & num
Holdtxt = Val(Mid(Holdtxt, Len(holdtext) - 12, 12))
End If...................

View 6 Replies View Related

Wrong Entry Into Data Validated Cell Triggers Debug On Change Event

Dec 14, 2011

I have a Change Event macro that works properly. I also have several cells that contain a drop down list. If a user tries to enter an incorrect entry...the debug is triggered on my even change macro.

Here's the piece of the Change macro that has issues. Specifically, the .undo line highlights.

With Application
.ScreenUpdating = False
.EnableEvents = False

Set SelectedCell = ActiveCell
myTitle = Cells(Range("Titles").Row, Target.Column).Value
myRow = Target.Row
.Undo: myBefore = Target.Value
.Undo: myAfter = Target.Value

View 3 Replies View Related

Yes/No Pop-up Window

Aug 28, 2006

I have a certain macro which copies data from one file to the other. There are several target files (refering to a given month each) and one source file. The user chooses a month from a drop down list in the source file which modifies a certain cell. The value of this cell decides on which of the 12 target files will be opened to paste the data to. The macro also copies the value of a cell which refers to the current date (=TODAY()) This number is then compared with a the range (value between two pints in time: start and end date of a given month). All I need is some sort of a pop-up window with a header i.e. WARNING. and the window text: You are about to send the information to a file which does not refere to the current month, are you sure you want to perform this action" and two buttons YES and NO in case the value of the current date does not match the range set up by the starting and ending of a given month in the target file. The button YES would then do waht ever the code that was placed before the pop-up window said, save the aplication and close it, and the NO button would simply close the aplicatiown without saving it. Something like that:

Sub Export()
'the whole code describing the action to be taken
If Range("A1").Value >= Range("A3").Value And Range("A1").Value <= Range("A2").Value Then
'here the A1 cell refers to the current date and cells A2 and A3 to the start and the end date of the month
End Sub

View 4 Replies View Related

Code "debug" Error 13

May 29, 2009

The two code extracts below are associated with two separate worksheets in the same workbook. They work fine. They simply are used to assign either a PO# or a Temp Unit #, located in a third sheet, in their respective sheets.

The problem is that when I'm in either the Master or the Work Orders sheets where these two codes are used, and I do something simple like drag down some values or paste something in a cell, I get the "Run time error "13" type mismatch error" in the popup debug window for my VBA code. And in each case, it highlights the codeline I've color coded below:

View 2 Replies View Related

Opening New IE Tab Instead Of A New Window?

Feb 6, 2013

i have a macro that performs the same search in many websites, opening a new ie window for any site. What i want now is opening a new tab in IE instead of a new window. To illustrate, here go some code:

Dim PartNo As String 'Declaro la cadena de texto que determina la busqueda
Public Sub BuscarPLCCenter()
Dim IE As InternetExplorer


I would like that all of these procedures opened a new IE tab to do the search, cause actually it opens like 15 windows at a time and is not user friendly enough.

View 4 Replies View Related

Tip Messaging (pop-up Like Window Perhaps)

Oct 30, 2008

I am using Excel 2003 and wish to make a tip message (pop-up like window perhaps) if a value of a particular cell is exceeded.

View 2 Replies View Related

Closing Immediate Window

Apr 18, 2009

Is there any way to have a macro, that is started from the immediate window, close the immediate window when it's done. My macro closes the immediate window, but as soon as it ends, the immediate window reopens and my cursor is inside it.

View 14 Replies View Related

Invisible Window

Nov 23, 2009

There is a column with a formula and a list validation, and an adjacent hidden column with numbered ids. When moving into the list validation cell the Worksheet_Selection_Change event code saves information about the Target cell - value, address, formula. When a value has been obtained from the list the Worksheet_Change event code looks up a belonging id in a lookup table and put this in the hidden id cell, and puts the saved formula back into the list validation cell. This makes the sheet (or window) unmanagable.

When I move around the sheet I can see the cell name in the Name Box, but the sheet itself is not visible. The only way to display the sheet is to add a new window (Window - New Window), choose the first "frozen" window (Window - 1. window) and quit this window. Then the new window is ready for use, but of course with the same limitations as the newly quitted one. Ring a bell, someone?? The funny thing is that in this workbook I also use the same functionality in another sheet without any problems.

View 3 Replies View Related

Set Window Size With VBA.

Feb 1, 2010

I'm looking for a way to use VBA to set the window size upon opening the workbook. When the document opens, there should be two windows, each taking up half the screen and each on a particular tab.

Currently, if I save the workbook with the window settings I want, when I open it, both windows are maximized. When I hit the restore button, they go back the settings with which they were saved, which is what I want it to look like as soon as it's opened. Also, a bonus would be for the code to determine the screen size, so it can fill the screen no matter what monitor/computer it's opened on.

View 4 Replies View Related

Copyrights 2005-15, All rights reserved