![]() |
|
|
Welcome to the { mindfrost82.com } forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
macro
Hello
I have created a spreadsheet for filling in details in a section and I want the user to input the data as and when it's needed. It contains the field headers to guide the user to fill-in the correct data) I created a macro to copy the section of the spreadsheet i.e. rows 3 to 10 and paste them below, which would be from 11 onwards. but I want to be able to run the macro again but paste the section below the last one that was pasted. When I run it, it pastes over the first section I pasted when recording the macro. In other words, how do I do it so that it targets the next empty row after the last section?. I hope that makes sense Excel 2003 |
|
|||
|
Re: macro
On May 22, 5:02 pm, "JB" <somehow@somewhere> wrote:
> Hello > I have created a spreadsheet for filling in details in a section and I want > the user to input the data as and when it's needed. It contains the field > headers to guide the user to fill-in the correct data) > I created a macro to copy the section of the spreadsheet i.e. rows 3 to 10 > and paste them below, which would be from 11 onwards. but I want to be able > to run the macro again but paste the section below the last one that was > pasted. > When I run it, it pastes over the first section I pasted when recording the > macro. In other words, how do I do it so that it targets the next empty row > after the last section?. > I hope that makes sense > Excel 2003 Use something like this in your code, where your data would be in columns A to Z dim lnglastrow as long lnglastrow=Range("a65536:z65536").end(xlup).row range("a"&lnglastrow).select |
|
|||
|
Re: macro
Hi
It goes as follows: Sub ReportIncident() ' ' ReportIncident Macro ' ' Keyboard Shortcut: Ctrl+r ' Rows("4:20").Select Selection.Copy Range("A23").Select ActiveSheet.Paste Application.CutCopyMode = False ActiveWindow.SmallScroll Down:=15 Range("A41").Select End Sub So when I do run the next one I want to go from under A41 and so on Thank you Jen "Dave" <Dave@discussions.microsoft.com> wrote in message news:53A74470-5BE5-4FE8-A4B5-4A6FD32088E8@microsoft.com... > Hi, > If you post a copy of your macro, we could suggest the changes needed. > Regards - Dave. |
|
|||
|
Re: macro
Thank you for your help
Sorry but I'm very basic in this. Where do I put it? do I add it to the macro or redo it? Ta "AndrewArmstrong" <a.armstrong11@comcast.net> wrote in message news:874071a7-49e2-4028-92f6-e398c7023b9a@m44g2000hsc.googlegroups.com... > On May 22, 5:02 pm, "JB" <somehow@somewhere> wrote: >> Hello >> I have created a spreadsheet for filling in details in a section and I >> want >> the user to input the data as and when it's needed. It contains the >> field >> headers to guide the user to fill-in the correct data) >> I created a macro to copy the section of the spreadsheet i.e. rows 3 to >> 10 >> and paste them below, which would be from 11 onwards. but I want to be >> able >> to run the macro again but paste the section below the last one that was >> pasted. >> When I run it, it pastes over the first section I pasted when recording >> the >> macro. In other words, how do I do it so that it targets the next empty >> row >> after the last section?. >> I hope that makes sense >> Excel 2003 > > Use something like this in your code, where your data would be in > columns A to Z > > dim lnglastrow as long > lnglastrow=Range("a65536:z65536").end(xlup).row > > range("a"&lnglastrow).select |
|
|||
|
Re: macro
Sub test()
Dim rng1 As Range Set rng1 = ActiveSheet.Cells(Rows.Count, 1).End(xlUp) _ .Offset(1, 0) Range("3:10").Copy _ Destination:=rng1 End Sub Or if rows are selected by user................. Sub test2() Dim rng1 As Range Set rng1 = ActiveSheet.Cells(Rows.Count, 1).End(xlUp) _ .Offset(1, 0) Selection.Copy _ Destination:=rng1 End Sub Gord Dibben MS Excel MVP On Mon, 26 May 2008 11:56:34 +0100, "JB" <somehow@somewhere> wrote: >Thank you for your help >Sorry but I'm very basic in this. Where do I put it? do I add it to the >macro or redo it? >Ta > >"AndrewArmstrong" <a.armstrong11@comcast.net> wrote in message >news:874071a7-49e2-4028-92f6-e398c7023b9a@m44g2000hsc.googlegroups.com... >> On May 22, 5:02 pm, "JB" <somehow@somewhere> wrote: >>> Hello >>> I have created a spreadsheet for filling in details in a section and I >>> want >>> the user to input the data as and when it's needed. It contains the >>> field >>> headers to guide the user to fill-in the correct data) >>> I created a macro to copy the section of the spreadsheet i.e. rows 3 to >>> 10 >>> and paste them below, which would be from 11 onwards. but I want to be >>> able >>> to run the macro again but paste the section below the last one that was >>> pasted. >>> When I run it, it pastes over the first section I pasted when recording >>> the >>> macro. In other words, how do I do it so that it targets the next empty >>> row >>> after the last section?. >>> I hope that makes sense >>> Excel 2003 >> >> Use something like this in your code, where your data would be in >> columns A to Z >> >> dim lnglastrow as long >> lnglastrow=Range("a65536:z65536").end(xlup).row >> >> range("a"&lnglastrow).select |
![]() |
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|