Link to home
Start Free TrialLog in
Avatar of AXISHK
AXISHK

asked on

List all selected cells in a Excel

How to write a macro to show all the selected cells in a current workbook ?
Avatar of Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Flag of New Zealand image

Hello,

what do you mean with "show all selected cells"? If you select the cells, you can already see them, so in what way do you want to "show" them?

Can you explain what you want to achieve? What is the bigger picture?

cheers, teylyn
Avatar of AXISHK
AXISHK

ASKER

Suppose the 3 cells in the attached file is selected, how to collect the values of all cells when I run the macro ? I want to do some calcuation for them.

Tks
selectedCells.png
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You could use a for/each loop along the lines of

Dim cel As Range

For Each cel In Selection
    ' your calculation, for example assign a value to each cell
    cel = cel.value * 1
Next

Open in new window

Avatar of AXISHK

ASKER

Tks