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!
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER