Thread: [Solved] Worksheet_SelectionChange
View Single Post
 
Old 08-23-2018, 05:34 PM
trevorc trevorc is offline Windows 7 32bit Office 2013
Competent Performer
 
Join Date: Jan 2017
Posts: 174
trevorc will become famous soon enoughtrevorc will become famous soon enough
Default Worksheet_SelectionChange

Hi All,
I am trying to make the current row being edited highlighted using the selection change event, what I have to do is first save the current row's cell formats (in say A1000:AM1000), then highlight the row, if I stay on that row do nothing and if I select another row restore the previous rows formatting, then highlight the new row.
Is there a way to stop the code from running every time the selection changes or do I need VBA to handle selecting the row to paste the current rows formatting then returning to the selected row, without the code trying to run again.
I have made a start on the code but got stumped debugging the re-running of the code before the sub finished, even in VBA selecting another row fires off the selection change event again. Any help is appreciated.





Code:
'Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
'H_Row = Selection.Row
'Range("A" & H_Row, "AL" & H_Row).Select
'   Selection.Copy
'   Range("A70").Select
'   Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
'Range("AJ1") = 6 'Selection.Interior.ColorIndex
'End Sub
Reply With Quote