Excel To check mark a cel in excel


Joined
Aug 28, 2006
Messages
2
Reaction score
0
hi all,

Can neone help me with this....
When i click the mouse on a cel of the excel sheet, it must be checked ('X' must appear in tht particular cel).
I think this is something to do with mouse click events, i am not sure abt it though.
so if it is to be done with mouse events, how do u go abt it???


help will be appreciated,

thanx
saru.
 
Last edited:
Ad

Advertisements

Joined
Aug 28, 2005
Messages
46
Reaction score
0
to change colour of cells when something else is done you need to use conditional formatting under the format tab, hope this helps, your post is a little vague.
 
Joined
Aug 28, 2006
Messages
2
Reaction score
0
hey i have modified the post, can u have a look at it now???
thanx
 
Ad

Advertisements

Joined
Aug 28, 2005
Messages
46
Reaction score
0
The standard way to do this is with the SelectionChange event. Every time the selection changes in the worksheet, the event is triggered. The event doesn't just trigger when a cell is clicked on, but also if someone presses a cursor control key that results in a different cell being selected.

As an example, let's say that you wanted cell B5 to contain the value X whenever that cell is selected. To implement that, you could use the following:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("B5")) Is Nothing Then _
Range("B5").Value = "X"
End Sub

This code is added to one of the sheet objects in the Project Explorer area of the VB Editor. Double-click the worksheet you want the event handler to apply to, and then add the macro to the resulting code window.

When the SelectionChange event is triggered, the target (the cell range being selected) is passed to the handler. The macro then checks to see if the target range contains cell B5, and if it does, stuffs the value 10 into cell B5. If you want to make sure that the macro only stuffs information into B5 if only B5 (the single cell) is selected, you can use this version of the macro:

Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = Range("B5").Address Then _ Range("B5").Value = "X"
End Sub


hope this helps a little.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top