i want to swap the values

bhandari

Active Member
Joined
Oct 17, 2017
Messages
359
Code:
Sub Swap_Values()
Dim Temp As Double
ThisWorkbook.Worksheets("JV").Activate
Temp = Cells(9).Value
Cells(9).Value = Cells(11).Value
Cells(11).Value = Temp
End Sub

can any one help mw with this code
row9
row10
row11

i want
row9=row11
row11=row10
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Shall new row 11 become old row 10 or row 9? Assuming it's row 9:
Code:
Sub Swap_Values()
Dim Temp As Variant
ThisWorkbook.Worksheets("JV").Activate
Temp = Rows(9).Value
Rows(9).Value = Rows(11).Value
Rows(11).Value = Temp
End Sub
 
Upvote 0
ROW 11 should come in 10 place
row 10 place should come in 11 place

if possible
instead of whole row i want only range("A:E")
 
Upvote 0
Code:
Sub Swap_Values()
Dim Temp As Variant
ThisWorkbook.Worksheets("JV").Activate
Temp = Range("A10:E10").Value
Range("A10:E10").Value = Range("A11:E11").Value
[FONT=Verdana]Range("A11:E11").Value[/FONT] = Temp
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,216
Messages
6,123,669
Members
449,114
Latest member
aides

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top