+ Reply to Thread
Results 1 to 11 of 11

CommandButton to copy to new sheet and format

  1. #1
    Registered User
    Join Date
    02-11-2009
    Location
    Norway
    MS-Off Ver
    Excel 2003
    Posts
    26

    CommandButton to copy to new sheet and format

    Hi!

    I'm trying to create av CommandButton in sheet "Totalt" and copy range "A8:I200" to sheet "Publisering" and then do some formatting...

    But gets "Run-time error '1004'"

    I have read that 'copy' from one sheet to another and then performing operations to the new sheet might be a problem. The CommandButton is only working for that spesific sheet (range)... I might be wrong, but need help.

    Here is the code:
    Please Login or Register  to view this content.
    Thanks!

    ruttian
    Last edited by ruttian; 09-19-2010 at 04:38 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: CommandButton to copy to new sheet and format

    Try:

    Please Login or Register  to view this content.

    Regards

  3. #3
    Registered User
    Join Date
    02-11-2009
    Location
    Norway
    MS-Off Ver
    Excel 2003
    Posts
    26

    Thumbs up Re: CommandButton to copy to new sheet and format

    Thanks a lot!

    Just what I wanted! Perfect.

    ruttian

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: CommandButton to copy to new sheet and format

    You're very welcome. Thanks for the feedback.

  5. #5
    Registered User
    Join Date
    02-11-2009
    Location
    Norway
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: CommandButton to copy to new sheet and format

    Hi!

    I have a follow up question concerning "With - End With"

    I'm still trying to perform action on another sheet than where the CommandButton1 is, and I have made some progress...

    (My project is a timing system for a cross country skiing club (200+ competitors), and the system has in fact been in use for more than 2 years... But I'm now trying to make the system more efficient and robust).

    I have this code (on click it puts the computer system time on the first available cell in column B. The code si good from sheet "Tidreg" but I want to make a registration from sheet "Competitors" without changing sheet...):



    Please Login or Register  to view this content.
    The first part is ok, but then the syntax (?) is wrong. I hope you see what I'm trying to do...

    This is the ok code for sheet "Tidreg":

    Please Login or Register  to view this content.
    Thanks!

    ruttian
    Last edited by ruttian; 09-17-2010 at 04:58 AM.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: CommandButton to copy to new sheet and format

    The ContactsForm example might help
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Registered User
    Join Date
    02-11-2009
    Location
    Norway
    MS-Off Ver
    Excel 2003
    Posts
    26

    Red face Re: CommandButton to copy to new sheet and format

    Hi royUK!

    I guess I could have used some of this for my Macros, but I was just looking for "the simple" solution. I have no idea of how to use variables...
    (I have looked into the macro in contacts.xls example...).

    ruttian

  8. #8
    Registered User
    Join Date
    02-11-2009
    Location
    Norway
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: CommandButton to copy to new sheet and format

    PS! For the record, I am an accountant and not a programmer...

    ruttian

  9. #9
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: CommandButton to copy to new sheet and format

    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  10. #10
    Registered User
    Join Date
    02-11-2009
    Location
    Norway
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: CommandButton to copy to new sheet and format

    Sometimes I feel so stupid... One simple line of code...

    Thanks!

    ruttian

  11. #11
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: CommandButton to copy to new sheet and format

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1