Link to home
Start Free TrialLog in
Avatar of pwflexner
pwflexner

asked on

Macro revision

Sub Switch()
I created a macro called Switch to switch two numbers located in adjoining cells (one above the other).  My problem is that I want the switch to occur based on whichever cell I have highlighted so that it switches the number in that cell with the number in the cell one row below it.  Instead the macro only switches whatever data is in the cells originally used when I created the macro.  

'
' Switch Macro
' Switches two prices
'
' Keyboard Shortcut: Ctrl+Shift+S
'
    Selection.Copy
    Range("D37").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Range("D36:D37").Select
    Selection.Copy
    Range("D35").Select
    ActiveSheet.Paste
    Range("D37").Select
    Selection.ClearContents
End Sub


Can someone please show me how to modify the macro so that it works based on the highlighted cell and not a fixed cell?  Thanks!
ASKER CERTIFIED SOLUTION
Avatar of nutsch
nutsch
Flag of United States of America image

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
Avatar of pwflexner
pwflexner

ASKER

Perfect!!