I've run into a problem and I cannot resolve. I am designing an Excel Application in VBA. During the execution of the VBA code, the user will press different keys on the keyboard. These keystrokes are determined by using the GetAsyncKeyState Function. The problem happens when I exit from the VBA code and move back to a worksheet outside the code execution.
Lets say a user has pressed the 'Q' and 'X' key just prior to the final VBA subroutine running and releasing the worksheets back to the user. On the worksheet, in the selected cell will appear the 'Q' and 'X'. For some reason these keystrokes are not 'flushed' from the keyboard buffer prior to the code completion and are being transfered to the active worksheet. This is really annoying if I am testing the code in the VBA editor, because the spurious keystrokes will be placed in my VBA code, causing me to search for the out of place characters.
I wrote a little program to highlight the cell that the cursor is currently selecting. The code is in Workbook_SheetSelectionChange. Everything works great, except that the paste buffer now clears itself so I cannot use paste/cut.
I've programmed in many different forms of BASIC in my days, but I'm having too much trouble with VBA, and can't figure out if it's me or if it's the version of Excel I'm using (2002). I wrote a program in Excel, where if certain cells contain values other cell's calculations will become active. I want to click on a button that I created on the spreadsheet, then be able to select different keyboard strokes to activate these cells. I understand that there are 3 event codes that circle around this concept and that is KeyDown, KeyUp and KeyPress. Whenever I type in what MS Help told me to type in for these events, it always returns a runtime error.
Does anyone know if there is anyway that we can command Excel to avoid accepting aNY KEYBOARD ENTRIES? what intend to do is restrict a certain region on a worksheet for Users not to be able to type anything but but there are commandbuttons on the header which use: Range("C65536").End(xlUp)(2, 1) = "Value for the last cell" code to get the input into the cell. The purpose is to make use of the cmdbuttons with mouse but the data notto be keyed in !!!
is there any way to copy and paste "value only" using keyboard? Ctrl+V is pasting everything. i want existing format to remain the same and using mouse is taking lot of time :
Some expert users can unhide a sheet in a worksheet which is protected by password. But I don't want to place a button in the worksheet for everyone to see and wonder what it's for. I can record a macro and assign a keyboard shortcut but I can't do it it with existing macros ?
I would like to be able to check a checkbox on a userform with a keyboard stroke rather than using the mouse. Any key will do, "P" or Enter would be prefered. It would make data entry much easier.
I have been working on a workbook, and all of a sudden, my keyboard no longer worked in Excel. No shortcuts, no CTRL+C, no CTRL+V, no CTRL+S, no CTRL+A, no F12 to save, no letters, no numbers.... The only button that is working is my ALT key, and I use the other letter keys just fine to navigate after pressing ALT.... But that's it!
I have still been able to work on it because I can still write in Word, and I can still write more code in the Visual Basic window, and I can still click the buttons I create under the Developer... but it's still frustrating to not be able to type a thing in any of the cells, formula bar, or be able to use any of the shortcuts. And now when I tried to close it, I can still select everything else, and I can close this workbook, but it won't close Excel.
I would like to use Shapes in excel, instead using userform as the code below.In this userform, it has command buttons for the numbers and the a text box to show the numbers.How can I do it, using square shapes for numbers and another rectangle shape, to show the written numbers.I would like to create a number keyboard using "shapes".
My macro essentially requires a deletion of the entire sheet, so I cannot run it through a button, it'd by definition be deleted. So I was thinking to run this macro through the keyboard, how to assign a keyboard key to existing macro?
I know that I can assign a keyboard shortcut to run a macro, but I have multiple items that are activated by command buttons and would like to be able to trigger them all with one keystroke.
There are a series of input cells in a protected worksheet and when the user hits an enter, tab or arrow key, the selection cycles through them in order. The cycle also restarts when the mouse clicks one of the cells out of order. After I switch worksheets and return to the first worksheet with the code, first it says there is a "Compile Error: Sub or Function Not Defined" and the code "Call SetKeys" in Sheet1 is hilighted. When I ignore that and stop the debugger, there is a "Run-time error '13' Type mismatch" and the code line "If arrIndex > 0 And arrIndex < UBound(arr) Then" is highlighted.
My question is: why doesn't the code work after I switch worksheets? especially given that it works perfectly before I switch worksheets. (ie the file opens on sheet 1 and everything is perfect, click sheet 2 tab and back to sheet 1 - nothing works) I also have yet to figure out why it seems to be necessary to post the same code in both ThisWorkbook and Sheet1.
Private Sub Workbook_Open() 'This code allows the user to change the unlocked cells, but protects each worksheet Dim wSheet As Worksheet For Each wSheet In Worksheets wSheet.Protect Password:="mypassword", _ UserInterFaceOnly:=True Next wSheet............................
I am looking for is a keyboard shortcut to resize a column to fit the largest text entry in that column. Currently I am using the mouse and double-clicking between columns.
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.
I use keyboard commands whenever possible. They are much quicker than the mouse.
For years I have been using [Ctrl]+[Shift]+[1] to format cells as numeric with two decimal places, 1000 separator(,) and showing negative numbers in black with a minus sign in front.
I have two sheets that contain data and I have to switch between them all the time, and I thought I could make it easy by assigning the "switch" to a macro. I am now looking to assign that macro so a single button, like the "`" key. I have tried various pieces of code but none of them worked.I think something like the below may work but I don't know how to start.
[Code]....
If Sheets("Sheet2") is active, then call switch 1, to switch back.