Sort In More Than 3 Keys

Feb 18, 2009

I scratched this macro to autosort on more than three keys on a cell change...but is not working:

Dim rng As Range
' Set Target Range, i.e. Range("A1, B2, C3"), or Range("A1:B3")
Set rng = Target.Parent.Range("A2:V1500")
' Only look at single cell changes
If Target.Count > 1 Then Exit Sub
' Only look at that range
If Intersect(Target, rng) Is Nothing Then Exit Sub
' Action if Condition(s) are met
' Do your thing here
rng.Sort Key1:=Range("G2"), Order1:=xlAscending, Key2:=Range("F2") _
, Order2:=xlAscending, Key3:=Range("E2"), Order3:=xlAscending, Key4:=Range("C2"), Order4:=xlAscending, Key5:=Range("B2")
, Order5:=xlAscending, Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _
:=xlSortNormal, DataOption3:=xlSortNormal, DataOption4:=xlSortNormal, DataOption5:=xlSortNormal
End Sub

The error goes to Key 4 saying itīs a compilation error, argument with name doesnīt founded.

View 9 Replies


ADVERTISEMENT

Using Keys To Run A Macro

Dec 15, 2009

Are we limited to just the Control key to run macros?
Can I use the Alt key?

View 2 Replies View Related

How To Remap Keys

Jun 23, 2007

Is there a way to remap keys in Excel? I would like to remap the F1 key.

View 2 Replies View Related

Alt Keys In 2007

Jul 28, 2008

I am having trouble with the 2003 Alt keys in 2007 ..

I have 2 computers (work & home)

The work computer works fine ... when i use same files on home computer some alt key features wont work?

Example Alt E S T .... (paste special formats)

Any ideas .... I've looked at sharing / protection ... cant find anything to fix it....

It cant be protection because the paste special formats works fine with a mouse or the new 2007 Alt key commands?

Just about ready to remove and re-install...

View 9 Replies View Related

Using VB To Press Certain Keys

Jan 15, 2009

Is it possible to create a script that will allow mimic the keypress of a keyboard?

For example, if I press the windows key and R, windows will bring up the run box and then I can type in C:Windows and press enter and it will open C:Windows.

Is it possible to have Excel do this?

This would mean I create a macro that has keypresses programmed in so I can run a command prompt and enter some details there then copy the data and paste it into Excel.

View 9 Replies View Related

Function Keys With Userforms

Sep 3, 2008

Does anyone know of any way at all to trap a function key while a userform is being shown, or will I need API for that?

View 13 Replies View Related

Sorting By Variable Keys

Oct 9, 2008

Sorting by variable keys
I have some code in a macro:

View 4 Replies View Related

Deleting Keys From A Collection?

May 26, 2009

Is there a way to remove a value from a collection after I've added it.

I have simplified the code I'm using to highlight what I'm trying to do.

Basically I'm adding 10 keys to a collection and want to remove the last one. There is a reason for this.

View 3 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

Using Arrow Keys As Input VBA

Aug 5, 2013

I am trying to create the game of snake in VBA as practice, but I cannot find how to use the arrow keys as input. From what I have read it seems that it may not be possible, but how to change the value of a variable every time an arrow key is hit, post how to do so.

View 2 Replies View Related

Entering Times Without Using The : Or . Keys

Feb 13, 2009

i am a rowing coach and have to enter a lot of splits every day after practice and am hoping to find a way to do it without having to use the : or . keys.

so a split like 1min. 27.5sec, displayed as 1:27.5 could be entered as 1275.

i see that there are some questions already about this but seem to just work with H:M:S and time of day, i tried but wasn't able to use these for my purpose.

another fly in this ointment is that i also enter heart rates on the same sheet so in A1 it would be splits A2 heart rate, A3 split A4 HR.....

i do this for approximately 40 rowers each day with different workouts each day so each worksheet has splits and HR in different rows and columns.

View 9 Replies View Related

Replicate Arrow Keys

Dec 16, 2009

I understand the end(x1Down), but i think I am missing something. I just want to go to the next cell left, right or Up, Down from whatever cell is currently selected. How do I replicate a 1 cell move as an arrow key would do?

View 9 Replies View Related

Cannot Scroll With Arrow Keys

Jul 18, 2006

For some reason, when i use my arrow keys to move from cell to cell it now only scrolls my screen around....What did i do, and how do i change it back? I find it sad that i can write code and this stumped me.

View 3 Replies View Related

Arrow Keys To Move The Box

Jul 5, 2007

When every I click in a excel box and try to use my arrow keys to move the box example: A3 to A4. All it does is move the page up and down or across. Is there some type of setting on that is not letting me do this. It use to allow me to. Until another employee got on it. I can not start over becouse I have months of work on this book.

View 2 Replies View Related

Disable All Shortcut Keys

Nov 20, 2007

I want to disable ALL shortcut key functions in my program. (i.e. if a user presses Ctrl+S it will NOT save, Ctrl+O will NOT open file, etc).

Of course I need this enabled again in something like workbook close for users to have this ability in other workbooks.

View 9 Replies View Related

Short Cut Keys For Deleting A Particular Sheet

Oct 23, 2008

I want to know the Shortcut key for deleting a Particular sheet(s) from the excel workbook.

View 10 Replies View Related

Cannot Print After Using Send Keys In Macro

May 21, 2014

I finally found 'Sendkeys' and by having it press {ENTER} I was able to get my data to do what I wanted.

However now I cannot print my page. I tried everything.

Sub Macro2()
'
'
Sheets("List").Select
ActiveSheet.Cells(5 , 2).Select
Selection.Copy

[Code] ......

I can copy/paste other things just fine after the SendKeys but CANNOT PRINT!

View 5 Replies View Related

Filter Data Using Keys In Dictionary

Feb 5, 2014

I am working on the last step in a very long project, how to filter my data based on keys in a dictionary.

The data I am working with (in the ActiveSheet) has a list of names (in column 6). I want to add these names as keys in the dictionary and the corresponding location (in column 7) as the items. Then, I want to filter the data by each key in the dictionary, copy the filtered data, and paste it into another workbook. I have included the code I have so far. It seems to work exactly how I want as long as I'm not using the dictionary.

View 2 Replies View Related

Custom Navigation Using Cursor Keys

Jun 13, 2008

Attached is a protected sheet. The yellow cells are unprotected. When the use is on the cell L3, and the right arrow is clicked I want it to jump to M6 and vice verser, in other words, navigate in order from left to right. Is it possiblwe to do this?

View 13 Replies View Related

Disabling Arrow Keys For InputBox

Jan 8, 2009

I noticed the arrow keys will move the active cell while I have an inputbox active. This will be an issue for my users, I need them to key in data only.

Is there a command that will disable the arrow keys while the users enter the requested data?

View 10 Replies View Related

Button With VB To Avoid Pressing Several Keys At Once

Mar 19, 2009

I would like to design a button (with macros),so that users of my excel page do not need to press CONTROL+SHIFT+F1+ALT,which needs to be pressed on my firm to get the new data from a central server.

View 3 Replies View Related

Capturing Keys When Workbook Is Open

Oct 19, 2009

How do I capture keys sent to Excel when my workbook is open / active?

I know when you write a macro you can assign a shortcut key combo to it, such as "Ctrl-Shift-s", but I can't find where / how Excel stores that information, and can only presume it is stored away not accessible to the coder, (ie. not by going via the macro -> properties boxes).

My issue is I want to capture a key combo, then from that call a function passing a variable dependant on the combo pressed, eg:

View 11 Replies View Related

Trigger A Macro On Arrow Keys

Apr 24, 2007

I'm creating a small Excel RPG where the player moves the around a blank worksheet with the walls of a maze appearing as you approach them (think dark corridors, you can see only 1 cell in all directions around you).

The players current location is shown by excel setting the activecell to the players location. Currently I have four buttons labeled Up, Down, Left and Right which the player clicks to move in the desired direction.

The testers were frequently missing the four movement buttons and this would put the activecell outside of the maze next to one of the buttons. They'd have to move it back manually.

I would like for the players to move around using the arrow keys to use the activecell, as you would normally move around a sheet... but before each movement there is a procedure that check IF the player can move in the desired direction or not (cell borders used for walls), and then once they've moved there are more procedures to check for monsters treasure chests etc.

How can I make the arrow keys trigger the macros that the Up, Down, Left and Right buttons currently trigger, and not just move the activecell?

View 9 Replies View Related

VBA Equivalent For Shift-Arrow Keys

Nov 7, 2007

Does anyone know the VBA equivalent to using the Shift-Arrow keys on the keyboard? I am wanting a macro to do this for me. Specifically I am wanting to use Shift-Arrow Right.

View 9 Replies View Related

Red Line Going Across The Spreadsheet While Using The Arrow Keys

Dec 31, 2008

if it's possible to have a red line going across the spreadsheet while using the arrow keys it follows you down through all cells. And is there a vba coding that someone has ready written.

View 9 Replies View Related

Arrow Keys Scroll Screen

May 23, 2008

I am relatively new to Excel 2007 and my arrow keys do not navigate cell by cell. When I press the right or left arrow keys, my entire screen shifts to the right or left but the cursor STAYS in the cell where it was. Likewise, when I press the up or down arrow keys the screen shifts up or down but again, the cursor remains where it was. Is there an option somewhere that I need to change?

View 3 Replies View Related

Open Hyperlink With Keyboard Keys

Aug 8, 2008

I use keyboard commands in my workbook, but I cannot seem to find one that will open a selected hyperlink.

The hyperlinks have a formula like this:

=IF(B1018<>"",HYPERLINK(CONCATENATE("I:directories", B1018),"Listen"), "")

I want to be able to arrow over to that cell and hit a button to play the file (which is contained in cell B1018 in the above example), and there doesn't seem to be a keyboard shortcut to do this.

View 3 Replies View Related

Dictionary Object Returning Keys Before They Are Added

Jun 27, 2012

I am using a dictionary object from the MS Scripting Runtime library to store a series of arrays and perform operations on the array cells as necessary. There is a for loop to go through the process of creating all of these entries. My issue is that when using the .exists property, it is returning a True even before the item has been added. Closer debugging indicates that the key is being added to the dictionary at the beginning of the for loop, even though no .add command is used and will not be used until the end of the loop. The result is that the values in the arrays do not totalize as intended.

Code for the dictionary build has been included below. I have attached the Excel file which contains the appropriate module which calls that function

VB:
Option Explicit[ATTACH]46705[/ATTACH]
Function DictAppTable(Loop_Range As Integer, Key_Range As Range, Dim_1 As Range, Dim_2 As Range)
Dim DictTable As Dictionary
Dim AppElement(0 To 0, 0 To 1) As Variant
Dim iD As Integer
Dim strAppID As String

[Code].... the previous post, as the pared down excel file which I posted had a slight error which prevented it from running

View 2 Replies View Related

Comparing Two Excel Sheets With Unique Keys

Aug 18, 2009

I need to compare the 2 sheets with respect to a unique key. Once the unique key matches , I need to compare 5 other columns of the two excel sheet.

Note : There could be missing rows in either of the excel , so its necessary that we look up 2nd sheet completely to find the unique key.

For Example : In sheet 1 : The unique key is preent in column B and in Sheet 2: The unique key is present in column I. Once we locate the rows in both the sheets with the unque key matching, we would need to comapre , columns A, C, E AND F of the sheet 1 with columns A,B,C AND D of sheet 2.

We need to report if all the data matches when the unique key is same.

View 6 Replies View Related

Keyboard Keys Are Not Working After Running Macro

Jul 24, 2014

I used keypress code in one of forms, after running following command non of my keyboard is working in excel. When I am restarting excel everything is fine. what could be the reason?

View 7 Replies View Related







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