Code to move a row based on fix values and paste it
Solved/Closed
sonkar
Posts
2
Registration date
Wednesday February 5, 2014
Status
Member
Last seen
February 8, 2014
-
Feb 5, 2014 at 11:18 PM
sonkar Posts 2 Registration date Wednesday February 5, 2014 Status Member Last seen February 8, 2014 - Feb 8, 2014 at 11:18 PM
sonkar Posts 2 Registration date Wednesday February 5, 2014 Status Member Last seen February 8, 2014 - Feb 8, 2014 at 11:18 PM
Related:
- Code to move a row based on fix values and paste it
- Battery reset code - Guide
- Samsung volume increase code - Guide
- Cs 1.6 code - Guide
- Saints row 2 cheats - Guide
- How to get whatsapp verification code online - Guide
1 response
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Feb 6, 2014 at 11:34 PM
Feb 6, 2014 at 11:34 PM
suppose data is like this
User ID Password Role Description
plant material
11111 222222 aa xxxx
zzzz 7889
11111 222222 aa xxxx
zzzz 7889
11111 222222 aa xxxx
zzzz 7889
11111 222222 aa xxxx
zzzz 7889
ths is in sheet1. copy this in sheet2 from A1 to preserve the data configuration
now try this macro
User ID Password Role Description
plant material
11111 222222 aa xxxx
zzzz 7889
11111 222222 aa xxxx
zzzz 7889
11111 222222 aa xxxx
zzzz 7889
11111 222222 aa xxxx
zzzz 7889
ths is in sheet1. copy this in sheet2 from A1 to preserve the data configuration
now try this macro
Sub test()
Dim j As Integer, k As Integer
Worksheets("sheet1").Activate
Range(Range("A2"), Range("A2").End(xlToRight)).Cut
Range("a1").End(xlToRight).Offset(0, 1).Select
ActiveSheet.Paste
Range("a2").EntireRow.Delete
j = Range("A1").End(xlDown).Row
For k = j To 2 Step -1
If k Mod 2 <> 0 Then
Range(Cells(k, 1), Cells(k, 1).End(xlToRight)).Copy Cells(k - 1, 1).End(xlToRight).Offset(0, 1)
Cells(k, 1).EntireRow.Delete
End If
Next k
End Sub
Sub undo()
Worksheets("sheet1").Cells.Clear
Worksheets("sheet2").Cells.Copy Worksheets("sheet1").Cells(1, 1)
End Sub
Feb 8, 2014 at 11:18 PM