Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-01-2010, 12:52 PM
Zack Zack is offline Macro trouble Windows 7 Macro trouble Office 2010 (Version 14.0)
Novice
Macro trouble
 
Join Date: Oct 2010
Posts: 2
Zack is on a distinguished road
Exclamation Macro trouble

Hey all this is my first time here, so I hope I can get some help from all you office Guru's.

Im working with a spreadsheet in Excel 2010 and have been tasked to create 3 macros. 1 macro to delete an entire row at once with a keystroke, which is done. And also 2 macros to move a row of data up 1 line or down 1 line and shift the rows around it, without losing any data.

I was able to create a macro to move a row of data up 1 lines and have the line above it shift down, basically swapping the two lines. Here's my "Move Line Up" code:

Sub Moveup()
'
' Moveup Macro
'
' Keyboard Shortcut: Ctrl+u
'
ActiveCell.Rows("1:1").EntireRow.Select
Selection.Cut
ActiveCell.Offset(-1, 0).Rows("1:1").EntireRow.Select


Selection.Insert Shift:=xlDown
End Sub

This method does work for moving a line. HOWEVER when I try creating one to move a row DOWN, all that happens is the selection box moves down, not the data itself.

Sub MoveDown()
'
' MoveDown Macro
'
' Keyboard Shortcut: Ctrl+a
'
ActiveCell.Rows("1:1").EntireRow.Select
Selection.Cut
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
Selection.Insert Shift:=xlDown
End Sub

BOTTOM LINE: Does anyone have any ideas here? I need to move a single row of data down 1 line and have the row below it move up. HELP!
Reply With Quote
 

Tags
excel 2010, macro



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble Inserting Cells ebolton Excel 4 07-21-2010 11:39 AM
Having trouble with layout master slides shs PowerPoint 0 04-21-2010 09:00 AM
Having trouble with keywords in Outlook Rule mfarring Outlook 0 02-03-2010 08:17 AM
Trouble with project editing!!! Guidd Project 0 07-10-2007 09:46 PM
Trouble updating a form TomCaesar Outlook 0 11-29-2006 10:52 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:22 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft