473,378 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Cell Change event in Excell

37
Hi All,

Is there any way so I can get event when moving cursor in excel sheet. What I meant by that if cursor is in cell A1 then I move to B1 at that time

I want cell change event should fire. At the movement I am able to get event when you change the cell value and press enter then I can get the cell change event.

Is there any way to achieve this. Any idea or sample code very much appriciated.

Many Thanks

John
May 28 '11 #1
1 1816
Stewart Ross
2,545 Expert Mod 2GB
You can use the Worksheet SelectionChange event for this purpose. You need to place an event handling sub in the code behind the relevant worksheet. If it was sheet1 in the default workbook then you place the handler in the sheet1 code. A simple example is provided below:

Expand|Select|Wrap|Line Numbers
  1. Public Sub Worksheet_SelectionChange(ByVal target As Range)
  2.     MsgBox "Current cell is Row " & target.Row & ", Column " & target.Column
  3. End Sub
The required range parameter (called target in the example) tells you what the current range selected on the worksheet is. If you need to do different things depending on what cell is selected you can use the relevant range properties (such as .row and .column) to work out which cells you are currently on.

If you need to respond to events on multiple worksheets you will need to have SelectionChange event handlers on the relevant code modules for each. The event handler for Sheet1 does not see or respond to the events on sheet2 if it is activated - it must have its own event handler.

-Stewart
May 29 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: R. Rajesh Jeba Anbiah | last post by:
I have Googled a lot, but couldn't still find the answer... I could see, I can trigger the "click" event like: button_object.Click() But, I need to trigger the onChange() of select options. I...
1
by: muhamad kassem | last post by:
hi all i have a program that display the content of the table from sql server this table change . how i can get the change event in this table .
1
by: djam | last post by:
Is there such a thing as a row change event in Win Forms? I can't seem to find anything similar, I'm using CurrentCellChanged but that gets fired mulitple times and its not the correct event for...
3
by: dave | last post by:
I have half a dozen web form radio buttons on a web form. Each of them is set to postback=true. However, if for instance radiobutton1 is already selected and the user selects it again, it performs...
7
by: Markus McGee | last post by:
Hi all, I have a quick question...I believe. On my web page, call it page A, I have a drop downlist with runat server enabled. When the drop downlist change event occurs it repopulates a...
1
by: Gordon | last post by:
Hi there, I have a VB.NET application which opens a new Excel workbook (and obviously worksheet). The cell values in the worksheet depend on certain formulae, therefore the sheet Calculate event...
4
by: Roger | last post by:
I have a datagrid and would like to know what even fires when a cell is changed? I want to know when the user changes a cell and moves to the next. I have some code that needs to be done to...
0
by: =?Utf-8?B?SiBTdHJlZ2Vy?= | last post by:
I have a procedure to increase/decrease the size of the columns in a datagrid proportional to their original size. I want to capture the event if a user manually resizes a column, so I can reset my...
3
by: SimonG via AccessMonster.com | last post by:
Hi, I would like to be able to compare a control's new value with its old value, whenever it is changed by a user. The control holds a numeric value, qty_Sold, when this value changes I need to...
2
by: muddasirmunir | last post by:
I am using vb6. I want to solve one problem to define clearly i will use a simple example. Take a form and put a combobox in it Private Sub Form_Load() Combo1.AddItem "Apple"
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.