Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Program issue w/ VBA on next row

I have taken VB in college and used it some but I have not
touched it in almost 4 years. I need help, I did a
recording macro where I copied from E6-M6 pasted in E9-M9
and wanted it go to go the next line automatically and
saved. Well when I run the macro it just stays in the
same place. I want the macro to copy the formula and when
someone uses it and presses ctrl+k it automatically enters
in the information and goes to the next line. Can someone
help!?!?!?!

This is what I have so far and I have tried other things
but it still doesn't work.

' Keyboard Shortcut: Ctrl+k

Range("E6:M6").Select
Selection.Copy
Range("E9").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("E10").Select
ActiveWorkbook.Save

End Sub

This is being used so people can enter in on one row at a
time information and when finished entering in the one row
they press ctrl+k and the macro does the rest and moves to
the next line and when the person is ready to enter in
another row the macro can do that.

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Program issue w/ VBA on next row

' Keyboard Shortcut: Ctrl+k

Range("E6:M6").Select
Selection.Copy
Range("E9").Select
if not isempty(Range("E9")) then
if isempty(Range("E10")) then
Range("E10").Select
else
Range("E9").End(xldown)(2).Select
End if
End if
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWorkbook.Save
End Sub

--
Regards,
Tom Ogilvy

"Erin" wrote in message
...
I have taken VB in college and used it some but I have not
touched it in almost 4 years. I need help, I did a
recording macro where I copied from E6-M6 pasted in E9-M9
and wanted it go to go the next line automatically and
saved. Well when I run the macro it just stays in the
same place. I want the macro to copy the formula and when
someone uses it and presses ctrl+k it automatically enters
in the information and goes to the next line. Can someone
help!?!?!?!

This is what I have so far and I have tried other things
but it still doesn't work.

' Keyboard Shortcut: Ctrl+k

Range("E6:M6").Select
Selection.Copy
Range("E9").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("E10").Select
ActiveWorkbook.Save

End Sub

This is being used so people can enter in on one row at a
time information and when finished entering in the one row
they press ctrl+k and the macro does the rest and moves to
the next line and when the person is ready to enter in
another row the macro can do that.

Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Program issue w/ VBA on next row

Try replacing all of your code with the following......
It assumes that the last row of column E is last copy-paste your macro made,
and that you always want to copy range E6 to M6 to the next empty row.

' Keyboard Shortcut: Ctrl+k

Dim lastrow As Long
lastrow = Cells(Rows.Count, "E").End(xlUp).Row
Range("E6:M6").Copy Destination:=Range("E" & lastrow + 1)
ActiveWorkbook.Save

End Sub

Cheers
Nigel


"Erin" wrote in message
...
I have taken VB in college and used it some but I have not
touched it in almost 4 years. I need help, I did a
recording macro where I copied from E6-M6 pasted in E9-M9
and wanted it go to go the next line automatically and
saved. Well when I run the macro it just stays in the
same place. I want the macro to copy the formula and when
someone uses it and presses ctrl+k it automatically enters
in the information and goes to the next line. Can someone
help!?!?!?!

This is what I have so far and I have tried other things
but it still doesn't work.

' Keyboard Shortcut: Ctrl+k

Range("E6:M6").Select
Selection.Copy
Range("E9").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("E10").Select
ActiveWorkbook.Save

End Sub

This is being used so people can enter in on one row at a
time information and when finished entering in the one row
they press ctrl+k and the macro does the rest and moves to
the next line and when the person is ready to enter in
another row the macro can do that.

Thanks!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add-In Program NoodNutt Excel Worksheet Functions 1 August 30th 08 06:59 AM
Is there a way to unload the loaded XLL file in Excel? Hi all, I amdebugging XLL link library using Visual C++. Everytime I rebuild the XLL, Ihave to close the whole Excel program and relaunch the Excel program again,and then load in the newly gene LunaMoon Excel Discussion (Misc queries) 0 July 28th 08 11:03 PM
Entering multiple barcode using Talbar program, having issue plea Starglitzyburst Excel Worksheet Functions 0 March 3rd 07 03:05 AM
My program SM Excel Worksheet Functions 2 October 22nd 05 04:52 AM
merging excel program with tdc finance program judy Excel Programming 0 November 5th 03 08:01 PM


All times are GMT +1. The time now is 06:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"