excel - Macro just for specific cell range -


i got following macro in workbook:

private sub worksheet_selectionchange(byval target range) ' clear color of cells cells.interior.colorindex = 0 if isempty(target) or target.cells.count > 1 exit sub application.screenupdating = false activecell     ' highlight row , column contain active cell, within current region     range(cells(.row, .currentregion.column), cells(.row, .currentregion.columns.count + .currentregion.column - 1)).interior.colorindex = 8     range(cells(.currentregion.row, .column), cells(.currentregion.rows.count + .currentregion.row - 1, .column)).interior.colorindex = 8 end application.screenupdating = true end sub 

but i work on cells f8:ir254, region matrix.

currently works in every cell contains region name, outside matrix.

would possible?

thanks in advance.

kind regards, s

yes, possible.

you must add lines of code @ beginning of sub:

private sub worksheet_selectionchange(byval target range)     dim rng range: set rng = range("f8:ir254")     if intersect(target, rng) nothing exit sub 

Comments