Set Focus, If Thats The Correct Code
Nov 7, 2008
I have a userform with several fields located in it. For the most part, it looks like a user information form, Name, Date,, stuff like that. There is a field that the user enters some information, and using the afterUpdate function for the field, it searches to see if the value is unique. The problem is that when I tab from that field, if the value is not unique, I want the cursor placed back in that field (textbox). SetFocus doesn't seem to do what I want, unless I am using it incorrectly.
View 9 Replies
ADVERTISEMENT
Aug 30, 2008
Overview: I have a workbook named MainPage.xls. This mainpage has several buttons and serves as a switchboard to launch other workbooks. Attached to this Main Page are two worksheets, "Source" and "Value1". The "Source" worksheet is graphical in nature and is used to collect data via a DDE channel to some production industrial processors and then on a timer "log" the data to cells in the "Value1" worksheet. Once the VB code is launched from the "Source" worksheet (via a start button), the code continues to run until it is stopped (via a stop button). The data is then graphed and printed out, etc.
This works very nicely and provides "live" graphing of some constantly changing data.
Once the "Source" worksheet data VB code is running, I need to be able to minimize the worksheets and return to my Main Page and further be able to open any one of the other workbooks on the Main Page and work with that page(s). Thus far, I can minimize the "Source" and "Value1" worksheets and return to the Main Page and the VB code runs along nicely in the background.
However... IF I attempt to open any other workbook from the Main Page, my data collection/graphing code stops and I get a Run-time error 9, subscript out of range... and Excel completely shuts down.
I know this must have something to do with the worksheet that runs the VB code losing focus when another workbook is opened.
View 14 Replies
View Related
Mar 31, 2009
I am having a problem with this script below. I think it is in the way the worksheet is picked. Can someone take a look and offer some advice on how to pick between the 2 sheets? I'm getting an error on this line in red below( object doesnt support this property or method)
View 14 Replies
View Related
Sep 19, 2007
I have a workbook that starts off with the following sheets:
MAIN_PAGE - Where filter criteria is selected via checkbox and PLOT button
RAW_DATA - unfiltered raw data
After running a series of macros tied to the PLOT button, two new sheets are created:
FILTERED_DATA(HIDDEN) - where the filter criteria from the MAIN_PAGE is applied, and the filtered data is stored.
CHART - The plot of the hidden FILTER_DATA sheet.
Every time the PLOT button is pressed, the the macro searches for the FILTERED_DATA and CHART sheets, and if present, clears and overwrittes with the new appropriately filted data. This works and suits the user's needs 95% of the time. However....
QUESTION
If the user decides to keep the old CHART and FILTER_DATA as well as the new FILTER_DATA and CHART, I need something to differentiate the two charts and data sheets. My thought was to have the user rename the CHART. The problem is that because the FILTERED_DATA sheet is hidden (and has to stay that way), how can the name change of the CHART be carried over onto the hidden FILTERED_DATA sheet, therefore keeping the plot and it's data in tact? For example, if I append the name CHART with a 1 to make it CHART1, how do I automatically change FILTERED_DATA to FILTERED_DATA1?
View 7 Replies
View Related
Mar 20, 2013
In an excel sheet, I am using a macro to filter. Macro code is as follows. When I run this macro, it returns 4 rows matching the criteria from 560 rows in the excel sheet.
VB:
ActiveSheet.Range("$A$1:$I$566").AutoFilter Field:=1, Criteria1:= _
">=11/11/2012 22:13", Operator:=xlAnd, Criteria2:="<=11/12/2012 6:47"
I want to use the same criteria in the vb.net code, to do same thru vb.net. But, when I run the same code in vb.net, it just returns only 1 row (1st row only).
VB:
[FONT=Consolas][SIZE=2][COLOR=#0000ff]xlsRange1.AutoFilter(Field:=1, Criteria1:=">=11/11/2012 22:13", Operator:=Excel.XlAutoFilterOperator.xlAnd, Criteria1:="<=11/12/2012 6:47")
This returns 1 instead of 4 expected.
View 2 Replies
View Related
Sep 14, 2007
I would like to know whether its possible to fix a sheet to always be the second sheet in a work book no matter how many other sheets are added. Currently I have set up macros to add subsequent sheets before the last sheet, so that Sheets("Number 2") remain sheets(2). Is there some way I can lock the first two sheets so that when I reference them in my code as sheets(1) and sheets(2) it will reference the right sheets. Right now I have it set up so that Sheets("Number 2") can be renamed by the user, and data inputted on this sheet, but I require that the user not be able to move this sheet and the sheet preceding it.
View 5 Replies
View Related
Feb 18, 2014
The code below works correctly on certain sheets. The code is supposed to loop through worksheets in an array, calculate the percent change from 1990 to 2012 and from 2005 to 2012, and put the calculations on the 4th and 5th row from the last non-empty row, respectively. All the sheets are identical except for 3. The sheets that are different only have a different number of years of data. For some reason this causes the macro to put the percent change calculations in random rows below the correct location. Also, the macro doesn't work correctly on one of the identical sheets.
[Code] ......
Example of how the macro runs correctly on an identical worksheet : correct.gif
Example of how the macro runs incorrectly on one of the 3 sheets that are not identical : incorrect.gif
View 6 Replies
View Related
Mar 21, 2008
I am trying to write some code that is linked to a Command button. The code in the command button is in my workbook called "MF Consolidated ACTUAL DAILY REPORT - Dev.xls" but then I have another workbook called "MF BANK EXPOSURE SUMMARY.xls" that I want to do some work with - namely delete blank columns and it is here that I am having the problem.
My problem is this: my code module is contained in my project "MF Consolidated ACTUAL DAILY REPORT - Dev.xls" and the columns that I want deleted are in the "MF BANK EXPOSURE SUMMARY.xls". Now even though I believe I have activated the "MF BANK EXPOSURE SUMMARY.xls" workbook the action, that of deleting the blank columns is performed on the "MF Consolidated ACTUAL DAILY REPORT - Dev.xls" workbook. Why?? Here is the code that I am using:
Sub Commandbutton()
'ASK FOR DATE AND SET IT IN THE REPORT
Workbooks("MF Consolidated ACTUAL DAILY REPORT - Dev.xls").Worksheets _
("Seg and Non Seg Bank Summary"). Range("I1") = Application.InputBox("PLEASE ENTER REPORT DATE IN THE DD/MM/YYYY FORMAT")
'ACTIVATE MF BANK EXPOSURE SUMMARY
Workbooks("MF BANK EXPOSURE SUMMARY.xls"). Sheets("Seg and Non Seg").Activate
Dim iCol As Integer
Dim Isheet As Integer
With ActiveSheet.UsedRange................
View 3 Replies
View Related
Feb 15, 2010
I'm trying to create a formula that will added the correct amount in the correct cells, I have create a dunny sheet in trying to achieve this. If Cell B8:B11 = ABS or Dum that any points won should be added to Cell L8:L11 right now its adding it into K8:K11. If Cell B8:B11 = is Blank any player points should be added to cells K8:K11. I'm using this formula throughout cells K8:K28 =IF(J8>J25,1,IF(AND(J8<>0,J8=J25),0.5,0)) Any thing in red is incorrect anything in blue is what I'm trying to achieve.
View 4 Replies
View Related
Jan 26, 2014
We receive about 20 sales files of several hundred lines of data each day from various agencies. I want to create a macro / VBA code which checks that the data submitted is correct so that we can upload it into our database without import errors and / or having to manually check each line of data.
I envisage something like an output report:
#####################
149 entries
Column A - Date - OK
Column B - Customer_Phone - Errors (Should be 11 digits)
Row 21 - Customer_Phone - Error (Not 11 digits)
Row 108 - Customer_Phone - Error (Contains letters)
Column C - Outcome - OK
Please correct and re-check.
#####################
View 4 Replies
View Related
Jul 3, 2008
I have a table with 3 columns of dates and then a column with Set # that I
feel in the box #.
I need to see how many items processed for each set per day.
Example:
[url]
The problem is that it counts the correct amount but not with the correct
dates.
The formula that I use is:
=SUMPRODUCT(--($I$3:$I$8<>"")*(($C$3:$C$8=39601)+AND($E$3:$E$8=39601)+AND($G$3:$G$8=39601)))
View 14 Replies
View Related
Feb 20, 2009
I'm trying to execute a macro and it won't put the focus (radio button) to select x pages wide by x pages tall in the Page Setup/Page/Scaling Area. I looked at the macro and can't find a setting in the code but yet the focus won't change. What can I do about this? In other words the radio button stays selected as "adjust to "" % of normal size. Here's the code...
View 2 Replies
View Related
Apr 2, 2009
I have the following code which copies specified cells from one sheet to the next available row on another sheet. I would like to keep the next available row somewhere near center focus on the display. Can I use the variable 1Row to do this, or maybe 1Row plus or minus 20 depending on how I want it displayed on the screen?
View 2 Replies
View Related
Jan 6, 2004
I am writing some VBA, and this is what is going on:
I display a form which asks the user to insert the desired number of invoices. After inserting the number, I would like a the cursor to appear in a textbox labeled "Invoice Date" (ref A28). Additionally, I would like the user to only have to key in the day and month. Therefore, I would like to have the cell be defaulted to / /2004.
View 9 Replies
View Related
Nov 2, 2007
I am using the following code to validate text entry in Textbox1 of a userform. I want that if the user enters a numeric value than a msgbox should popup and then cursor should get focus on Textbox1. But with this code, it is setting focus on textbox2 and not on textbox1.
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If IsNumeric(TextBox1.Text) Then MsgBox "Please enter TEXT value only.", vbInformation + vbOKOnly
TextBox1.SetFocus
End Sub
View 9 Replies
View Related
Apr 25, 2006
I have an application in excel in which a “combobox1” has been created on the main sheet of excel. Somewhere during the code execution the program requires input from the “combobox1”. What is the code required to highlight the “combobox1” allow the user to select from the box and then return control back to the regular code?
View 4 Replies
View Related
Jun 2, 2006
I've got a worksheet with a cell called "cellName" and a button "cmdSearch". When I enter a string in cellName and press cmdSearch a query is done on a database and the result is returned to the form. Now, when I enter text into cellName I then have to click on a different cell before I can click on cmdSearch. What I'd like to do is have cmdSearch take focus if I press enter in cellName. I know how to do this with a UserForm, but I like having all of this on the worksheet and not dealling with a popup box.
View 4 Replies
View Related
Jun 17, 2008
is there any way to know if a COMBObox has the focus?
* * *
I have a ComboBox and when I press ENTER inside this comboBox a run a Macro
Private Sub CbFormularios_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
some times I am inside the ComboBox and one of the Item whithin this combobos is Selected, but stead of pressing the enter keyboard I press a commadButton but to run the macro attached to this command button I have to know if the cursor of my mouse is whithin the ComboBox "Over the comboBox". kind of:
If ActiveSheet.Cbox1.Value Is Not highlited Then call Macro1
View 4 Replies
View Related
Dec 9, 2008
I have an active form that is always in focus. I would like to be able to seamlessly transition back to the worksheets under it, and move back and forth between the worksheet entry and form entry. Is there some way to alter the focus between events to do so (like a mouse over type event)? Currently, I can only exit the form to get back to the worksheet. excel 03 sp3
View 2 Replies
View Related
Jan 8, 2009
I am running software that calls an Excel macro using DDE. The macro populates a sheet with information to be printed, then prints the sheet.
I would like for this to take place in the background with Excel never taking focus from the software that calls the Excel macro. Currently Excel some times takes focus from the software and some times does not. The macro also takes the information it prints and stores it to another sheet, but I don't think that's the culprit stealing focus from the other software.
View 7 Replies
View Related
Jan 12, 2009
The following code gives me a 'Method' Range of Object'_Worksheet' failed error. I'm using Excel 2003.
View 7 Replies
View Related
May 2, 2009
I have 3 workbooks in XLStart. I want to change the workbook that gets the focus after they are all open. The workbook i want to have focus is DG_Tourny.xls
View 2 Replies
View Related
Jun 24, 2009
I've made a non-modal 'Toolbox' form that floats over my worksheets. When a button is clicked a graphic item is copied from a hidden sheet and pasted into the current sheet. The graphic remains selected but the toolbox form takes the focus away from the sheet. When the user wants to move the graphic there is no problem in mouse-dragging but I'd like the user to be able to nudge the graphic using the keyboard arrow keys without having to click to give the sheet the focus. So, I guess the question is: How can I give focus to the worksheet following the Paste action?
View 3 Replies
View Related
Jul 7, 2009
I have a userform that is called by clicking on a button and it copies the value in cell A to my userform. This works great it is called via:
View 5 Replies
View Related
Jul 21, 2009
I have a userform with several inputs which are validated, and should the input be invalid an ErrorProcedure is run. This basically displays a message telling the user what is wrong, and it should also be highlighting the text in the relevant field, but for some reason it is not doing that.
View 6 Replies
View Related
Sep 28, 2009
I had to reset my excel on friday now today I'm getting an error when opening up an workbook. The error is " Cant move focus to the control because it is invisible ,Not enabled or type that does not accept focus. I have this code in a workbook when the workbook opens
View 2 Replies
View Related
Apr 10, 2012
How to change focus back to Excel from other applications, how simply to report what application currently has keyboard focus - there is no need to change it?
View 2 Replies
View Related
Jan 18, 2014
How do I isolate "FOCUS" in the following string
FORD FOCUS TOYOTA CORROLA
View 9 Replies
View Related
Mar 18, 2014
I have a macro that launches another program (Windows Title - Storm). I then use sendkeys to have it export the file to an excel file. (This launches another instance of excel.) I want to be able to focus back to (Storm) so I can sendkeys to close the program down. I can get it to the end result using sendkeys, but I am trying to have it switch back to the Storm application so the user does not need to close it manually.
View 2 Replies
View Related
May 10, 2007
I've got a Macro that generates three reports for me, one at a time.
After a report has been generated it creates an Email and attachs the report to the Email, I then check the report is ok before sending out.
The problem is, that once the first Email has been generated Excel is pushed into the background and the macro sloooooooows down.
I believe (though I will quite happily be wrong) this is because Excel is no longer the PC's main concern.
What I was wondering was, is it possible to bring Excel back to the foreground once the Email has been generated.
View 9 Replies
View Related