+ Reply to Thread
Results 1 to 4 of 4

Macro to populate adjacent cell but if already populated leave cell alone if false

  1. #1
    Registered User
    Join Date
    06-05-2006
    Posts
    16

    Macro to populate adjacent cell but if already populated leave cell alone if false

    I am VERY inexperienced with VB. That being said, I have a spreadsheet that I've coded to put a value in one cell based on a value in another cell:

    Please Login or Register  to view this content.
    The problem is, besides not knowing how to code, when I place other data in column T, the code overwrites it when I run the macro.

    To clarify - I have five columns in a spreadsheet and, based on what goes in the first column (the first column will either be blank or contain "N/A"), I want the second, third, fourth and fifth columns to auto-populate (if there's nothing, it remains blank, if it's "N/A", then "N/A" ). The reason these columns would otherwise remain blank is that I need to populate them with dates.

    My macro works well initially, but if I place dates in the second, third, fourth or fifth columns, the next time I run the macro this data gets overwritten.

    I'm obviously in way over my head.

    Hope this is clear enough.

    ANY help at all would be appreciated.

    Thanks.

    Cindy
    Last edited by CindyG; 06-15-2009 at 09:46 AM. Reason: Rules broken

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

    Re: Macro - leave cell alone if false...I think...help!

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    Your post does not conform with the Titles Rule as well
    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
    06-05-2006
    Posts
    16

    Re: Macro to populate adjacent cell but if already populated leave cell alone if fals

    OK - I thought I was getting somewhere, but alas, another roadblock. I have modified the code as follows:

    Please Login or Register  to view this content.
    However, once I've run the code once, it won't work again, for example: I'll populate data in cell T8 through to, say, T15 and then launch the macro to autofill the adjacent cells in column U. It works perfectly up to this point. But if I go back later on and populate data in T15 to T25. When I launch the macro again, it no longer works - at all.

    Any suggestions?

  4. #4
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Macro to populate adjacent cell but if already populated leave cell alone if fals

    Hi, Try this:-
    Please Login or Register  to view this content.
    Regards Mick

+ 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