+ Reply to Thread
Results 1 to 5 of 5

Getting the amend function/code to work correctly

Hybrid View

  1. #1
    Registered User
    Join Date
    08-12-2008
    Location
    Milton Keynes, England
    Posts
    7

    Getting the amend function/code to work correctly

    Hi can anybody help me to solve this problem, it has bee driving me mad over the last few days.

    I have started to build a user form that (will) allow myself to update a database at various stages of our projects. everything seems to be working apart from the update/amend function. When i search for a project and make any amendments as soon as i hit the update button it copies it to a completely random cell and doesnot overwrite the existing row.

    I have attached the files, it would be great if someone could take a look and help me, i am new to VBA so not quite with it yet.

    Thanks guys/girls
    Attached Files Attached Files

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    have you looked at the code in the Databaseform example here

    http://www.excel-it.com/vba_examples.htm

    You use .Find to find a range - r, but then you use ActiveCell to update. I don't think your code actually activates r.

    I would declare r above the procedures in the userform module to make it available to all procedures, then use r.Offset instead of AciveCell.Offset
    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
    08-12-2008
    Location
    Milton Keynes, England
    Posts
    7
    Hi thanks for the response Roy,

    I have looked at the sources you mentioned, but i cant see how i can amend the code without having to start afresh. I think ? like i said i am new to this and it has pretty much been hit and miss.

    I have tried a few other things but dont seem to be getting any luck.

  4. #4
    Registered User
    Join Date
    08-12-2008
    Location
    Milton Keynes, England
    Posts
    7

    Can anyone look and see where im going wrong

    If anyone can look and see where im going wrong wih this code im almost where i need to be, i will even make a donation to anyone who can help ?

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I can't see where you actually set c as a range. You use .Find to find r.

    I think you are making your code way over complicated, the code could be shortened considerably.
    Last edited by royUK; 10-14-2008 at 04:22 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. creating a work roster generator
    By jjsule2000 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-09-2008, 05:04 AM
  2. Amend filter code to work with combobox
    By macximus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-09-2008, 02:33 AM
  3. Using a Cell to Hide/Unhide a Work Sheet
    By drgogo in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-09-2008, 02:12 AM
  4. Tasks for work
    By Chutzpah in forum Excel General
    Replies: 1
    Last Post: 10-03-2006, 12:54 PM
  5. vba so I don't have to close wkbk and re-open to have it work
    By johnandbeth in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-28-2006, 04:53 PM

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