Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 23
Default PLEASE help with cut/paste macro

I have two worksheets: "residential" and "blanktables"

"Residential" has a 27-row form people fill out. The user fills out
one form per student.

Since most users have many students, I'm trying to make a button on
the last line of the form so that when the user clicks it, it
executes a macro that inserts a new, blank form for another student.

The macro goes to "blanktables" and selects an empty blank form;

Returns to "Residential" and pastes a new blank form below the first
one (the first row below the button). There's a button on the bottom
of the new blank form running the same macro, in case the user wants
to add another form below that one. Then another one below that one,
and so on. Some users have over 100 students.

At first I just created the button and performed the task using
"Record New Macro." It worked fine. BUT every time the user clicks the
button on the NEW form, it pastes it in the same place, over and over.
How can I keep it from doing this? It needs to paste it on the row
below the button, no matter where the button is.

The recorded macro looks like this (the button is on A30):

Sheets("blanktables").Select
Range("A1:B29").Select
Selection.Copy
Sheets("Residential").Select
Range("A31").Select
ActiveSheet.Paste

Please reply to the newsgroup.
THanks a heap,
Ron M.

  #2   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default PLEASE help with cut/paste macro

If you have a value in the bottom row of column A of the form, then this
should do it....otherwise the offset will have to be adjusted......

Sub AddForm()
Sheets("blanktables").Select
Range("A1:B29").Select
Selection.Copy
Sheets("Residential").Select
Range("a65000").Select
Selection.End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
End Sub

Vaya con Dios,
Chuck, CABGx3



" wrote:

I have two worksheets: "residential" and "blanktables"

"Residential" has a 27-row form people fill out. The user fills out
one form per student.

Since most users have many students, I'm trying to make a button on
the last line of the form so that when the user clicks it, it
executes a macro that inserts a new, blank form for another student.

The macro goes to "blanktables" and selects an empty blank form;

Returns to "Residential" and pastes a new blank form below the first
one (the first row below the button). There's a button on the bottom
of the new blank form running the same macro, in case the user wants
to add another form below that one. Then another one below that one,
and so on. Some users have over 100 students.

At first I just created the button and performed the task using
"Record New Macro." It worked fine. BUT every time the user clicks the
button on the NEW form, it pastes it in the same place, over and over.
How can I keep it from doing this? It needs to paste it on the row
below the button, no matter where the button is.

The recorded macro looks like this (the button is on A30):

Sheets("blanktables").Select
Range("A1:B29").Select
Selection.Copy
Sheets("Residential").Select
Range("A31").Select
ActiveSheet.Paste

Please reply to the newsgroup.
THanks a heap,
Ron M.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default PLEASE help with cut/paste macro

if you want the macro to paste it on the same sheet but below the current
"form" then instead of defining the range("a31") as your paste location you
have to make the macro search for the end of the previous form. this can be
done by using end(xlup).

try this for your code:

Sheets("blanktables").Select
Range("A1:B29").Copy
Sheets("Residential").Select
Copyrow = Cells(65536, 1).End(xlUp).Row + 1
Cells(Copyrow, 1).PasteSpecial


this finds the last cell in column A that has information in it and pastes 1
row beneath that. hence row + 1. so you may have to change it depending on
the layout of your spreadsheet.

hope this helps

-josh

" wrote:

I have two worksheets: "residential" and "blanktables"

"Residential" has a 27-row form people fill out. The user fills out
one form per student.

Since most users have many students, I'm trying to make a button on
the last line of the form so that when the user clicks it, it
executes a macro that inserts a new, blank form for another student.

The macro goes to "blanktables" and selects an empty blank form;

Returns to "Residential" and pastes a new blank form below the first
one (the first row below the button). There's a button on the bottom
of the new blank form running the same macro, in case the user wants
to add another form below that one. Then another one below that one,
and so on. Some users have over 100 students.

At first I just created the button and performed the task using
"Record New Macro." It worked fine. BUT every time the user clicks the
button on the NEW form, it pastes it in the same place, over and over.
How can I keep it from doing this? It needs to paste it on the row
below the button, no matter where the button is.

The recorded macro looks like this (the button is on A30):

Sheets("blanktables").Select
Range("A1:B29").Select
Selection.Copy
Sheets("Residential").Select
Range("A31").Select
ActiveSheet.Paste

Please reply to the newsgroup.
THanks a heap,
Ron M.


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
Cut and Paste Macro M.A.Tyler Excel Discussion (Misc queries) 3 April 28th 07 02:50 AM
cut and paste macro wally Excel Worksheet Functions 6 December 12th 06 03:51 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM
cut and paste macro? VBA12thRoundDraftPick Excel Discussion (Misc queries) 1 April 1st 05 10:09 PM


All times are GMT +1. The time now is 06:06 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"