+ Reply to Thread
Results 1 to 8 of 8

Automatic Replication

  1. #1
    Registered User
    Join Date
    10-23-2007
    Posts
    20

    Automatic Replication

    Hi once again.

    This time I have a sheet that holds some simple details, but for the less gifted PC users, I need a command button to perform a replication function, but unfortunatley, I'm not that skilled with programming.
    There's a screenshot attached, but one of the cells has a Vlookup function in it.
    I need the Vlookup to be replicated as well (onto a new row when the button is pressed). Also, when the row is replicated, it would be useful if all of the cell contents were empty to let new records be put in.

    One last thing...I've made these style of buttons before (New Record). But whenever I actually press it with the code in, the button itself moves to a random position on the page... I have no idea why, but it isn't exactly useful.
    Any ideas on how to stop it?

    Please help!....again...

    Cheers.
    Attached Images Attached Images

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Do you want to copy all the data as well as formulas?

    There is a way in Excel options to automate Excel to copy formulas & formats in Tables. From the Tools Menu select Options, then Edit & make sure that "Extend list formats & formulas" is checked.
    Hope that helps.

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

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    10-23-2007
    Posts
    20
    Nah, I just need the formulas. They ought to bring back "N/A" if theres no data to support it, but the necessary data is put in manually.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Have you tried the manual way from Options?

    Try this VBA

    Option Explicit
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-23-2007
    Posts
    20
    Thanks again. It works, but...

    Please Login or Register  to view this content.
    This does delete the data from the new row, only problem is that it also changes the value of my vlookup on the same row to "#Ref!"
    As a result, I removed that line and the copying works fine, but I'm at a loass to why it changes the value of my vlookup. I debugged and it turns out the part that changes is:
    =VLOOKUP(LEFT($E6,4),Kits!$A$1:$B$2,2,FALSE)
    The bit in bold becomes "#Ref" when the code runs.

    Is there any chance you could tell me how to delete individual cell contents whilst the code runs so I can pick them off one by one?

    Cheers!
    Last edited by VBA Noob; 02-06-2008 at 04:14 PM.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Can you attach a small example workbook so that I can see what you need?

  7. #7
    Registered User
    Join Date
    10-23-2007
    Posts
    20
    Here you go. Sorry it took so long.

    Ta
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    10-23-2007
    Posts
    20
    bump

    ...Hope this explains it better.

+ 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