Macro Shortcut Key Failing

Feb 9, 2007

I am unable to create a macro and later go back and assign a shortcut key and run the macro.

View 9 Replies


ADVERTISEMENT

Pivot Table Macro Failing On Open

Jun 3, 2008

I have written the following code that is supposed to be running on opening a work book. The macro is being called via Application.Run "CreatePT" which is in the this workbook code in a Sub workbook_open().

The code run on its own is fine with no errors... It only bombs out when its called via application.run then its a run time error 1004? ...

View 9 Replies View Related

Run Macro Via Shortcut Keys

Feb 10, 2010

The following macro works when I run using Alt+F8+Enter
The macro also works when it is linked to a button on the worksheet.
However, it does not work when I try to use the keyboard shortcut Ctrl+Shift+P.
I've tried adding the shortcut key code into the macro -- still doesn't work.
I've tried changing the shortcut key to a different letter

View 8 Replies View Related

Macro Stops When Using Shortcut Key?

Dec 10, 2013

I have a macro stored a module at Personel workbook and i am using personel workbook as a hidden one. when i assign a shortcut below macro it is not working but whrn i am press F5 at VBA Editor it is working.

Here is the code:

Code:
Sub Transferdata()
On Error GoTo err1:
Application.DisplayAlerts = False

[Code]....

View 7 Replies View Related

Assigning Macro Shortcut

Oct 17, 2006

I have a workbook that when I open it opens a toolbar that was designed for it. I have been asked to make changes to this toolbar. One of the changes is to allow shortcut keys to run these modules. I have tried recording a macro and viewing the code, I tried applying this code there but it does not using the shortcut key. note that this toolbar is only available to this workbook, so these macros are not available to the personal workbook.

View 4 Replies View Related

Assigning Shortcut To A Macro

Jan 29, 2007

when we record a macro it gives us a option to assign a shortcut key to that macro how ever that is only in combination of "Ctrl" my question is that is there a way by which we can use any other combination like "Ctrl"+"Shift"+ <key>

View 2 Replies View Related

Assign Macro Shortcut Key

Jul 7, 2007

I have several macros where I have assigned keyboard shortcuts, as below. Yet they don't work.

Sub My_FastCleanup()
' My_FastCleanup Macro
' Keyboard Shortcut: Ctrl+Shift+M
-macro stuff-
End Sub

View 9 Replies View Related

Assigning Shortcut Key For Macro Execution

Dec 18, 2012

I have a macro where I am assigning a variable and the value of the variable is a path where the data is stored. i am trying to assign a shortcut key for macro, i tried to run the macro by going to the vba mode and then click on the F5 function key and the macro run absolutely fine. but when i use the shortcut key the file just opens and just exits the macro.

Code:
Option ExplicitDim a, b, c As Long
Dim myFolder As String
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As Variant
Sub Macro1()
Application.DisplayAlerts = False

[Code] ....

View 4 Replies View Related

Macro Stops Running Via Shortcut Key

Oct 20, 2006

Can't run vba macro. I have the following problem with a macro in excel. i wrote it, the macro runs very good from excel /tool/macro/macros/run, i also put a button on toolbar -it works too, i want to assign a keyboard shortcut from tool/macro/macros/options / shortcut and THE MACRO RUN INCOMPLETELY (stops running ).

Actually the macro opens all files in a specific folder, and delete their codes as follows:

Sub delete()
Const strNotFound As String = "There is NO Excel files..."
Dim ffTmp As FoundFiles
Dim wb As Workbook
Dim objVbc As Object
Dim objFile As Variant
Dim lngRet As Long
Application.DisplayAlerts = True
'Search Excel files
With Application.FileSearch
.NewSearch
.LookIn = "C:Corectii\_CS"
.SearchSubFolders = True
.FileType = msoFileTypeExcelWorkbooks...............

View 7 Replies View Related

Adding A Keyboard Shortcut In A Macro

May 6, 2007

How can i add a keyboard shortcut in already saved macro. Is there any way to do it or need to write a new macro?

View 2 Replies View Related

Sendkeys Macro Will Not Start With Keyboard Shortcut

Aug 18, 2014

However, I have not been able to find a solution. I created 2 macros that work using the alt+F8 and enter option as well as the run from the macros menu method. Whenever I try to use the keyboard short cut eg. Ctrl+e it will either not do anything or pause and then select every cell. The codes are below:

Sub Macro5()
'
' Macro5 Macro
'

[Code]....

I have tried multiple letter options and have also tried many macros in a new workbook and I cannot get it to run with the keyboard shortcut.

View 10 Replies View Related

Macro - Shortcut For Moving Between Sheets In A Workbook.

Jan 13, 2009

Could some one amend the VBA below to allow a continous loop on moving to the previous sheet within a workbook. Currently when I move to the first sheet if I use the shortcut key I get a debug error.

View 6 Replies View Related

Assigning Hotket (shortcut) To An Exisiting Macro?

May 9, 2006

Is there any way to define a shortcut for an exisiting macro. The reason for this request is that after a lot of struggle I got a VBA code to work (as a macro)... initially I had created an icon and had linked the same to this macro.... However I feel that defining a short-key would be much more productive.

View 2 Replies View Related

Replace Keyboard Shortcut For Macro Dialog

Jul 19, 2006

I would like to replace the keyboard shortcut for the macro dialog box
The standard Alt + F8 is on the right side of the keyboard

I would like somethine of the left side such as Alt + Q

View 3 Replies View Related

Rename Macro In Properties Window Loses Shortcut

Dec 2, 2008

I recorded one that does a very simple task, converts formulas to values. I saved it in my personal workbook, all is well. I noticed that excel names them Module1, Module2 etc. I thought it would be better to name them, so in the properties window next to "name" i changed Module1 to ConvertFormulas.

However, when i go to a worksheet, the keyboard shortcut no longer works. Reverting back to the old name Module1 solves this. Clicking Tools -> Macro -> Macros, selecting ConvertFormulas and then Options and modifying the shortcut.

View 4 Replies View Related

Can't Assign Shortcut To Macro: 'Options...' Button Disabled

Feb 23, 2010

I'm trying to assign a shortcut to a macro I wrote in VB. However, when I go to Tools->Macros->Macros, none of my macros (whether coded in VB or recorded) have the "Options..." button enabled, so I can't assign the macro. This happens whether I use Excel 2003 or Excel 2007. The file is not readonly and I have tried the various levels of macro security. I have VBA installed.

View 5 Replies View Related

Unprotect Failing

Oct 11, 2006

I have a workbook that has several macros. When the workbook is saved, it cycles through and kicks off several of them.

This works fine, no errors. I have another macro that saves and then emails the workbook. When this macro runs, the same set of macros is launched due to the save method however it errors during one of the macros.

Basically what's happening is that the one macro (derivecountry) unprotects a sheet and inputs a data value. This macro works fine when run independantly but when it runs as a result of the email macr, the sheet does not get unprotected and the error results.

Here is the code line that runs to unprotect but doesn't always work

ThisWorkbook.Sheets(strShtName).Activate
ActiveSheet.Unprotect (strPassword)

I've also tried

ActiveSheet.Unprotect password:=strPassword

View 4 Replies View Related

Email Form Failing

Mar 9, 2009

From this forum I've borrowed code and reused in my own CapEx approval form. The form is originated and goes through three people for approval. Everything seems to work ok on the form but it always forwards to the first approver rather than the next in sequence. I cannot see where the code is wrong.

View 2 Replies View Related

Create Folder Failing

Jun 16, 2009

i run this macro but it fails

Can anbody tell me why please?

And how can i correct it? .....

View 6 Replies View Related

Loop Through All Worksheets - Failing?

May 14, 2013

This macro should copy all data from all worksheets and past them into the sheet named "Consol" however It is not looping and only pastes the one sheet.

Sub LoopThroughSheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
Formula
FinalRow = Range("A65536").End(xlUp).Row
Range("A2:U" & FinalRow).Copy

[code]....

View 6 Replies View Related

SaveCopyAs. Code Failing To Fire.

Jan 28, 2009

I have an Excel 2007 workbook with over a dozen user forms and plenty of code that I have mainly obtained from the web and tweaked to suit my needs. I am a novice with VBA, so not really up to writing anything but quite simple code.

My issue is I have some code set to fire on Workbook_Open that will save a versioned copy of the workbook, to the same network folder that the original resides in, with an incrementally increasing file name. the file is stored on a network, but access should not be an issue as I have full access and have no problem saving to this folder, also the event works fine up until I shut down Excel. I have also tried saving to My Documents to avoid the network issue, same result, worked fine as long as Excel is not closed, fails if I do.

It all works fine until I close down excel completely and re-open, where it then fails to work. There are other events happening in the same Workbook_Open sub that still work fine each time, so the sub is firing on open, but this one event fails. I get no error message at all, just no new file copy created.

The workbook is essentially doing the job of an Access database (I know even less about Access), I have a user form as a main menu and various other forms for various data entry and reporting tasks. I am exiting the w/book via a cmd button on the main menu (I've deliberately restricted users control, as many are not very pc literate). I have conducted numerous trials consisting of running the code from the VBA window, closing w/book via cmd button WITHOUT accepting the std save option and re-opening from Explorer window, closing w/book via cmd button WITH accepting the std save option and re-opening via Explorer and all worked perfectly over many sample runs. But when I closed Excel totally (Not just the w/book), created a desktop shortcut and opened from there, that line of code just doesn't seem to do anything, no error or hang or anything. The only way I can get it to function again, is to re-save the w/book (As either a new file with code edited to suit, or overwrite the original), and keep Excel open whilst only closing this w/book. It then functions perfectly again on opening.

I have enclosed below the Workbook_Open sub and some other subs that append to a user log on opening, these work fine all the time. I enclose the others in case they may have some bearing, as they are also fired from the Workbook_Open sub and show no issues at all.

Any suggestions gratefully accepted as I am struggling. As mentioned above, the ONLY part of the Workbook_Open sub that fails is the line "ThisWorkbook.SaveCopyAs newFileName". I have even added "MsgBox "The new FileName is: " & newFileName" immediately after it, and that displays new filename correctly. It seems to me to be hingeing around the SaveCopyAs event, but I don't want to assume that, being the novice I am.

View 12 Replies View Related

Refedit Control Failing In 2007

May 24, 2007

I'm finding that my add-ins that worked perfectly on Excel 2003 are not functioning on Excel 2007. One of the main issues seems to be loading any UserForms that use the RefEdit control. I get a message saying:

--------------------------------------------------
Run-time error '459':

Object or class does not support the set of events
--------------------------------------------------

View 5 Replies View Related

Multiple Date Based SUMPRODUCT Failing

Nov 18, 2009

I have the the need to show the sum of the product of sheet 2 on sheet 1 if several conditions are met.

The formula is working except for the first array:

=SUMPRODUCT(--(Bid_Circuits=$A2),--(Bid_Week_End=MONTH(D2)),--(Bid_Week_End=YEAR(D2)),--(Bid_Completed))

When I use XL's evaluate feature, XL seems to find the proper data yet returns #VALUE!

View 14 Replies View Related

Find In Code To Search On Different Sheet Is Failing

Jun 26, 2007

The below code works well if it is on the proper sheet, if the active sheet is not active then it errors- Why? I think I have properly qualified the path to the desired sheet I wish to search on.

Error msg: Activate method of Range class failed

And how do I handle this?

Set Ws = Workbooks("ViewRenameDeleteFiles.xls").Sheets("Item Record List")
What = InputBox("Enter the Name You are Searching for its Record#", "Item Name Searching On")

Ws.Cells.Find(What:=What, After:=ActiveCell, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate

View 9 Replies View Related

Code Failing To Subscript Out Of Range Error

Jun 21, 2006

I have the following code which works successfully on my Excel 2002 PC and my Excel 2003 PC.

However when I take it to a clients machine it fails...

View 9 Replies View Related

Returning Workbook/sheet Through Property Is Failing

Mar 27, 2007

I made a new class to make other code less redundant, but it isn't functioning. The class has a "workbook" and "worksheet" member, and these can be accessed through properties. The problem is that the properties don't actually seem to return anything, and no data can be accessed through them.

Private mActiveWorkBook As WorkBook
Private mActiveWorkSheet As Worksheet

Property Get wSheet() As Worksheet
wSheet = mActiveWorkSheet
End Property

Property Get wBook() As WorkBook
wBook = mActiveWorkBook
End Property

'Sets active WorkBook
Sub SetActiveWorkBook(ByVal wBook As String)
Set mActiveWorkBook = Workbooks(wBook)
End Sub

'Sets the activeWorksheet in the workbook.
Sub SetActiveWorkSheet(ByVal wSheet As String)
If mActiveWorkBook Is Nothing Then
MsgBox ("Invalid WorkSheet selection - WorkBook not defined")
Return
End If

Set mActiveWorkSheet = mActiveWorkBook.Worksheets(wSheet)
End Sub

This class is used in the macro as such:

Dim uDate As Updater
Set uDate = New Updater

uDate.SetActiveWorkBook ("Book1.xls")
uDate.SetActiveWorkSheet ("TestTab")

'Below Code is not functioning

uDate.wSheet. Range("A1").Value = "foo"
' Expected result - set Cell A1 in sheet testTab = "foo"
' Actual Result - nothing

Dim st As String
st = uDate.wSheet.Range("B5").Value
MsgBox (st)
' Expected results - bring msgBox of values of cell B5, this cell is not empty
' Actual Result - Empty Message box comes up

So - its fairly obvious to me that something is wrong with the properties. The members themselves are not null, I have verified in the debugger that the class members refer to actual sheets/workbooks, but the properties don't like passing anything out and show as "variable not set" in the debugger. How can I get this to work?? It works fine when I do not use the class, like such:

Dim wB As WorkBook
Set wB = Workbooks("Book1.xls")

Dim wS As Worksheet
Set wS = Worksheets("TestTab")

Dim st As String
st = wS.Range("B5").Value
msgBox(st)

But I would like to get the class and properties to work to save clutter elsewhere.

View 6 Replies View Related

Delete Rows Without Named Ranges Failing

Apr 3, 2008

I have a dynamic named range in my worksheet:

Range Name = AssignDt
RefersTo: =OFFSET('Raw Data'!$W$2,0,0, COUNTA('Raw Data'!$A:$A)-1,1)

I perform a routine in VBA which deletes unwanted rows of data from my worksheet. The problem occurs if row 2 happens to be one of those rows. It not only deletes Row 2, but it also deletes my Named Range.

View 7 Replies View Related

If Statement Failing When Comparing Text Box Values On Userform

Jun 12, 2014

I am trying to compare to values that a user inputs in a user form. It's ok if they are not the same I just want the user to know it. I am only including the part where the if statement is failing:

VB:
If Me.VSLongQuant.Value <> Me.VSShortQuant.Value Then
MsgBox VerUnBal
If VerUnBal = vbNo Then
Exit Sub
End If
End If

I have VerUnBal as Long and defined as:

VB:
VerUnBal = MsgBox("The Long and Short option Qunatities are not equal." & Chr(13) & _
"Is this intended to be an unbalanced vertical spread?", vbYesNo, _
"Unbalanced Spread Alert")

I can provide more info as necessary. There are two problems 1) the message box is appearing whether the numbers are equal or not, and 2) clicking No in the message box does not cause the Sub to exit.

View 6 Replies View Related

VBA - Cells Property Failing - Object Does Not Support This Method

Jan 5, 2010

I am trying to use the Cells Property in VBA but it is not working and I cannot figure out why for the life of me. Below is my ....

View 9 Replies View Related

Autofilter Code Failing On Shared Workbook & Protected Sheet

Sep 3, 2007

I have a protected worksheet with some macros running on it, and I have been requested to make the workbook shared. Trying to implement this, I keep getting the standard "1004 You cannot use this command on a protected sheet" error when applying an autofilter.

Here is what is making this problem a little tricky:

- As the workbook is shared, I cannot do Protect UserInterfaceOnly because you can't change the protection settings on a shared workbook without unsharing it. Needless to say, I cannot unshare the workbook.

- When I protect the sheet, I do allow the user to use autofilter. Consequently, Sheet.Protection.AllowFiltering and Sheet.EnableAutofilter both are on. Still, I keep getting the error.

The failing line of code is:

shData. Range("_filterDataBase").AutoFilter lngField, strArg

where shData is the codename of the sheet, lngField is the number of the field and strArg is the filtering criteria.

My guess is, that the error comes from the fact that (for some silly reason) in VBA the .AutoFilter method is used to create a new filter, not only to use an existing one. The members of Sheet.AutoFilter.Filters collection are read-only, and cannot be used to modify the existing filter.

View 3 Replies View Related







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