From a current Active Cell, how do you simulate the following Keyboard Keystrokes in the order?
- Ctrl + Shirt + Down Arrow
- Shirt + Up Arrow
I cant quite get it to work out from my current active cell.
Thanks in advance for looking at this.
Last edited by clemsoncooz; 01-06-2012 at 03:35 PM.
I am assuming you meant Shift not shirt.
Application.OnKey "^+{Down}"
and
Application.OnKey "+{Up}"
To thank someone who has helped you, click on the star icon below their name.
I hate reading
Portfolio
I need a job.I am young and incompetent
Haha Yes JieJenn....I meant Shift.Thanks for looking at this.
But that code isnt quite working (at least for me).
If you look at the attached, sample 1-6-12a.xlsm , let say I want to select the numbers 1 thourgh 18, and assuming my current active cell is already in G4=1, How do I write the code to simulate the keystrokes:
- Ctrl + Shift + Down Arrow and then releasing Ctrl but still holding shift, press the up arrow.
Those keystrokes select all the numbers.
I realize there are others ways to select this data, but the code I am look at will be going into a macro and I dont know where this data is going to be so I cannot use cell references...I just want to simulate that keystroke combo.
Maybe ...
Range("G4", Range("G4").End(xlDown).Offset(-1)).Select
Microsoft MVP - Excel
Entia non sunt multiplicanda sine necessitate
Thanks shg, but I cant hardcode G4, because I am not sure that the date will be in G4. Thatss kind of why I was wondering about it being from the active cell.
I was thinking something like -But this code is selecting one too high - It is selecting all the data that I wont, but also including the header.Range(ActiveCell, Cells(Rows.Count, ActiveCell.Column).End(xlUp)).Offset(-1).Select
Range(ActiveCell, ActiveCell.End(xlDown).Offset(-1)).Select
Microsoft MVP - Excel
Entia non sunt multiplicanda sine necessitate
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks