Detecting CTRL Key Or ALT Is Pressed

Sep 29, 2013

How could I detect if the CTRL (Control) or ALT key has been pressed. I want to execute a macro when either one is press over a given cell.

View 3 Replies


ADVERTISEMENT

Macro To Paste Values Instead Of Formula When User Uses Ctrl-C And Ctrl-V (no Command Button)

Jun 10, 2013

I was thinking of how the Worksheet_Change(ByVal Target As Range) macro can be used to paste values instead of formula when the user uses Ctrl-C and Ctrl-V. Instead of assigning a macro to a command button for user to activate.

Suppose I have a worksheet where the range ("D7:D56") is where I would want the user to paste his values in it.
I have to factor in the possibility that these values have formulas attached to them, and that the user is not tech-savvy enough to know about the "paste special --> values" functionality of excel, and chooses to use the Ctrl-C, Ctrl-V method instead.

What then appears are ####### which might alarm the user.

Neither would we want the user to press a button (which we can assign the xlpastevalues macro as an alternative) as that adds an extra step for the user. There is also a chance the user might not use the button, or overlooked it.

Is it possible to use the Worksheet_Change(ByVal Target As Range) macro, or sth similar, to paste values instead of formula when user uses Ctrl-C and Ctrl-V?

View 6 Replies View Related

Loop Until A Certain Key Is Pressed

Aug 7, 2007

how can I go about this?

View 9 Replies View Related

Detecting Top Of Page

Feb 5, 2009

Is there a way of detecting, when printing, that a cell is at the top of the page?

I am not talking about the automatic "Rows to repeat at top" option on Page Setup; I have programmatically suppressed repeating information in Column A but I want to repeat that information if the column is fed to a new page.

View 2 Replies View Related

Detecting Same Value In 3 Cells

Mar 11, 2009

Would like to detect same value in 3 cells.

Q 16, R 16, S 16

If there is a same value appearing in two of the three cells.

View 11 Replies View Related

Detecting The Last Column

Mar 15, 2007

I've written a macro to copy data from a series of columns on one sheet and past it on another sheet in a specific way. However, what I really want to do, is write the macro so it automatically detects what the last column is, either by defining a range consisting of the last column, or by writing "Last Column" in one of the cells of the column, and having the macro detect it.

Dim i As Variant
For i = 5 To 56
' What I want to do is have the second number be the last column, instead of 56.
Sheets("MASTER").Select
Selection. AutoFilter Field:=i, Criteria1:=">0", Operator:=xlAnd
Range("Basic_Data").Copy
Sheets(" Consolidate").Select
ActiveSheet.Paste
ActiveCell.Offset(0, 4).Range("A1").Select
Sheets("MASTER").Select...........................

View 5 Replies View Related

Run A Macro When Enter Is Pressed

Dec 4, 2009

I'm trying to get a macro to run in my worksheet anytime someone presses the Enter key. I've been trying to use Private Sub Worksheet_Change(ByVal Target As Range) and getting extremely frustrated. I’ve tried a bunch of things and nothing seems to work. This is my latest that doesn’t work.

View 5 Replies View Related

How To Run MACRO When DELETE Key Is Pressed

Apr 10, 2012

I would like to detect when the user uses the "DELETE" key and would like to run a macro at the same time.

how to detect it and run a macro in VBA.

View 6 Replies View Related

Run Macro When Right Arrow Key Pressed

Apr 1, 2009

I have Sheet2 containing Supplier data in 2 columns - SupplierTAxCode and SupplierName (unsorted)

Sheet1 contains the Expenses section.

In Sheet1, column E6 to E1000, after inputting each SupplierTAxCode and pressing the RIGHT ARROW key, I would like to automatically get the SupplierName in column F6 to F1000 - from the corresponding data in Sheet2

In the event that the input in any of the cells in E6 to E1000 does not exist in SupplierTAxCode in Sheet2, would it be possible at the same time, to change the background color of the adjacent cell (SupplierName) in column F6 to F1000 at the same time - as a reminder to add those to the Supplier data in Sheet2 at a later date.

I could use Index Match and Conditional Formatting, but am concerned about the file sizes.

View 9 Replies View Related

Use Onkey To Make Something When A Key Is Pressed

Oct 20, 2006

Onkey is used to make something when a key is pressed. There is a instruction to make something when any key is pressed?

View 4 Replies View Related

Detecting Formulas Vs. Constants

Oct 1, 2006

In my company we have many spreadsheets with sections that contain formulas, which may be overwritten with "hard coding", manually entered constants, in certain situations.

Is there a way I can detect the differences between the two types of cells? I would like to setup conditional formatting that would highlight constants in a table that would generally only contains formulas.

View 14 Replies View Related

VBA Not Detecting Email Address?

Jun 20, 2014

It worked well at the time and continues to work well.

The problem I have is that I've copied it for use in a new workbook and for some reason it's not picking up email addresses and storing them in the string "stemails", so that when the email is created there are no addressees. Column BA does have email addresses in it however.

[Code] .....

View 2 Replies View Related

VBA Detecting Color Change

Feb 10, 2012

Using Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) I can execute code when values in the cell change, but it can't check if the foreground or background color changes. What event can detect this? If no event can, is there any way at all?

Found this, I will look into this loop: Capturing cell color change in VBA

View 5 Replies View Related

Detecting And Separating Integer

Dec 1, 2008

A1 : Style 998 45702B WRAP DRESS 1 0 0 0 1

Try to accomplish:

I would like to remove the "1" in between "Dress" and "0"

in other word remove integer from string but starting from right only.

B1 = should contain 1

View 9 Replies View Related

Detecting Non Contiguous Row Selections

Dec 22, 2008

I execute custom Insert and Delete macros whenever when the user has selected a single contiguous range of rows to insert or delete.

But I don't know how to detect if the user has selected multiple, non-contiguous rows. Is there a way to detect this situation, and if so, is there a way to "loop" through the individual selections?

View 9 Replies View Related

Detecting What Object Was Clicked

Jul 22, 2006

I've been working on a visualizer for large data sets and I'm trying to create a flexible interface. What I am trying to do is populate a sheet with objects(rectangles, triangles, etc.) and linking them all to the same macro. The macro would detect what had clicked it and read the alternative text which would hold the command procedure for that object. I've seen how people detect cursor position but I have not come across anything to detect the object that was clicked. The code I've found (in another post) is as follows:

Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Type POINTAPI
x As Long
y As Long
End Type

Sub CurosrXY_Pixels()

Dim lngStatus As Long
Dim typWhere As POINTAPI

lngStatus = GetCursorPos(typWhere)
MsgBox "x: " & typWhere.x & Chr(13) & "y: " & typWhere.y, vbInformation, "Pixels"
End Sub

This works but I can't figure out how to detect the object it clicked. I was hoping to use

ClickedObject = ActiveWindow.rangefrompoint(typeWhere.x, typeWhere.y)
Command = ClickedObject.AlternativeText

but all I get is errors.

View 2 Replies View Related

Sensing/Detecting Format Changes

Aug 16, 2006

I need to code a procedure which detects when a cell has changed color (I cannot assume where the cell is).

I thought I might be able to use the worksheet_change procedure, but this only 'reacts' when the cell contents change. Can anyone point me in the direction of the right procedure to implement.

View 9 Replies View Related

Detecting Existence Of Worksheet

Feb 14, 2007

I have a macro tht deletes sheets from my workbook. How do I check if these sheets exist before deleteing them? Thus so that

Worksheets("MySheetName").Delete

Does not generate an error if "MySheetName" doesnt exist?

View 2 Replies View Related

Detecting When A Worksheet Is Deleted

Mar 20, 2007

I am working on a workbook in which you can click a button on an index page to create a new sheet in the workbook with the name "meeting" and the number meeting that it is. The new sheet is then added to the index page. I am looking for a way to detect when a sheet is deleted so I can update my index page accordingly. I need to be able to know when a meeting is deleted so I can rename all meetings after that meeting and then update my index.

View 7 Replies View Related

Detecting Page Breaks

Mar 20, 2007

I want a macro to assess whether there's a page break before column P, if so, remove it and continue, if not... continue.

View 7 Replies View Related

Using Ctrl+M As Shortcut

Nov 6, 2008

i have tried using the letter M as a shortcut key (because it is to activate a "Move" function) but unfortunately it doesn't work. I gather from this that not all of the keys are available as shortcut keys presumably because they already have function.

Is there a way around this? and/or is there a list somewhere of the available shortcut keys?

View 13 Replies View Related

CTRL + TAB Not Working

Feb 27, 2007

the keyboard shortcut to switch between workbooks in the application seems to have stopped working on my boss' machine.

View 4 Replies View Related

Run Macro When Enter Key Pressed In Certain Range

Mar 4, 2014

I need to be able to run a macro called "Daily_Fuel_Line_Save2" when the enter key is pressed in any cell in the range A10:F10, but I still need to be able to use the tab key between the individual cells and change values in this range before starting the macro.

I already have the following code on the sheet which I would also like to keep.

[Code] .....

View 2 Replies View Related

CommandButton Generate Number When Pressed

Jan 25, 2009

I want to get number (going from 1 to 15 (for example)) when i click on commandbutton (on userform without textboxes, combos , etc, ..... except only one commandbutton)!

In other words, when i click on commandbutton, i want to get (on msgbox) number 1, then when i click again on commandbutton, i want to get number 2, then when i click on it third time, i want to get number three on msgbox window, and so on until i close userform!

View 12 Replies View Related

Running Macro On Any Key Pressed Event

Oct 9, 2009

how to make a code so that it captures the event of pressing any key of the keyboard and triggers a macro.

I tried using OnKey method but the problem with this is I am getting stick to any particular button whichever i specify in the onkey method wheareas I want to keep it general for any button in the keyboard.

Also if anyone can suggest how can I use OnKey method to use the "S" key to launch a macro.

View 9 Replies View Related

Put Records Into 2 Sheets With One Button Pressed

May 22, 2006

Private Sub ValidarCampos()

Dim r As Long
Dim c As Long
Dim s As Worksheet
'Set s = Active.Worksheet( Name)
Dim Error As String
' Dim ws As Worksheet
Dim ValorMensaje As Long

'Turn off Screen refresh
Application. ScreenUpdating = False

'Use Cells(Row, Column) for range adddress
r = ActiveCell.Row
c = ActiveCell.Column ..................................

How can I simultaneously with this code put data from textboxes to Active sheet and sheet "Izpisi". So when the button Add(dodaj) is pressed the data goes to active sheet and sheet ("Izpisi") at the same time

View 9 Replies View Related

Detecting If Only One Row Is Selected, Have Problem With The Cntrl Key

Jul 7, 2009

I want to enable button on the Menu and Toolbar if User is selected entire row (only one row). If it is selected some Range or more than one Row, the button must be disabled. I'm using this to detect what is the user selection:

View 2 Replies View Related

Grading Spreadsheet - Detecting Array

Mar 20, 2007

I have created a table with the values of each letter (A = 4, A- = 3.7, B+ = 3.3, through F)

I would like to have a points column which multiplies my letter grade (references a value from the table) by the units the grade is worth.

What function can I use to compare a letter grade with a value I've set.

Example:

Grade: B+
Units: 4
GPA Points Earned: = 3.3 * 4

View 14 Replies View Related

Detecting Size Of Data On Clipboard

Mar 22, 2010

I am trying to write a macro to paste the data that has been copied onto the clipboard into my worksheet. However I want to paste it in different ways depending on what data is there.

This is what I have so far:

Sub ImportTissue()
Sheets("Tissue").Select
If "dimensions of clipboard data are 5 cells by 5 cells" Then

Range("E11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

[Code] .........

View 8 Replies View Related

Detecting Change In Spreadsheet - Which Cell

Apr 13, 2012

How to detect a change in a spreadsheet, but how do i etermine on which cell the change happened?

Basically, I need something like this, if in the range of b1:b30 a cell is changed by the user, let say B??, then change or modify (via a subroutine) cell A??.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'
' detect which cell in the range b1:b30 changed
' then modify the cell to the right (or left) of the changed cell
'
End Sub

View 4 Replies View Related







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