How to select and deselect rows in Excel

G

Guest

I have to Question regarding selecting and deselecting rows,columns,... in
Excel.

1-When some row or cells are selected how we can we just deselect one row
or cell or column?We usually do it by keeping the Ctrl key in other office
program.

2-Is there any way that we can use to select raws or columns one in
between?It could be very useful.

Regards

Gallant
 
G

Gord Dibben

Gallant

I have added right-click menu items assigned to these two macros from Chip
Pearson.

If you want to use them, post back and I can show how to add them to the
right-click menu or you could just add them to a couple of buttons on your
Toolbar.

Sub UnSelectActiveCell()
Dim Rng As Range
Dim FullRange As Range
If Selection.Cells.Count > 1 Then
For Each Rng In Selection.Cells
If Rng.Address <> ActiveCell.Address Then
If FullRange Is Nothing Then
Set FullRange = Rng
Else
Set FullRange = Application.Union(FullRange, Rng)
End If
End If
Next Rng

If FullRange.Cells.Count > 0 Then
FullRange.Select
End If
End If
End Sub

Sub UnSelectActiveArea()
Dim Rng As Range
Dim FullRange As Range
Dim Ndx As Integer
If Selection.Areas.Count > 1 Then
For Each Rng In Selection.Areas
If Application.Intersect(ActiveCell, Rng) Is Nothing Then
If FullRange Is Nothing Then
Set FullRange = Rng
Else
Set FullRange = Application.Union(FullRange, Rng)
End If
End If
Next Rng
FullRange.Select
End If
End Sub


Gord Dibben Excel MVP
 

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