Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / August 2007

Tip: Looking for answers? Try searching our database.

Help with Macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RoadKing - 26 Aug 2007 01:01 GMT
Good evening:

Thanks in advance for your help
John
______________________________________________________

Sub MoveData()
'
' MoveData Macro
' Macro recorded 8/25/2007 by John Donadio
'
' Keyboard Shortcut: Ctrl+z
'
   Range("A12:L12").Select
   Selection.Copy
   Sheets("Activity").Select
   Range("A1").Select
   Selection.End(xlDown).Select
           Range("A26").Select          ** I need this to go to the a blank
row rather than returning to A26**
   ActiveSheet.Paste
   Range("A1").Select
   Sheets("Data Sheet").Select
   Application.CutCopyMode = False
   Selection.ClearContents
End Sub
Dave Peterson - 26 Aug 2007 01:27 GMT
Option Explicit
Sub MoveData2()

   Dim FromRng as range
   Dim ToRng as range

   with workSheets("Data Sheet")
       set fromrng = .range("A12:L12")
   end with

   with worksheets("Activity")
      set torng = .cells(.rows.count,"A").end(xlup).offset(1,0)
   end with

   fromrng.copy _
      destination:=torng

   fromrng.clearcontents
   
End Sub

And I don't think I'd use ctrl-z as my keyboard shortcut.  That's the shortcut
for Edit|Undo.

How about ctrl-shift-Z.

> Good evening:
>
[quoted text clipped - 22 lines]
>     Selection.ClearContents
> End Sub

Signature

Dave Peterson

Gord Dibben - 26 Aug 2007 01:35 GMT
This will find the first blank in column A

Sub MoveData()
   Sheets("Data Sheet").Select
   ActiveSheet.Range("A12:L12").Copy Destination:= _
           Sheets("Activity").Cells.End(xlDown) _
           .Offset(1, 0)
   Range("A1").ClearContents
End Sub

No need for all that selecting, copying and pasting that Excel records.

To find the first blank cell at the bottom of the column and copy to that range
use this......

Sub MoveData()
   Sheets("Data Sheet").Select
   ActiveSheet.Range("A12:L12").Copy Destination:= _
           Sheets("Activity").Cells(Rows.Count, 1).End(xlUp) _
           .Offset(1, 0)
   Range("A1").ClearContents
End Sub

Gord Dibben  MS Excel MVP

>Good evening:
>
[quoted text clipped - 22 lines]
>    Selection.ClearContents
>End Sub

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.