+ Reply to Thread
Results 1 to 2 of 2

Duplicate data from field above if cell is blank

  1. #1
    Registered User
    Join Date
    05-02-2011
    Location
    Northampton
    MS-Off Ver
    Excel 2010
    Posts
    8

    Duplicate data from field above if cell is blank

    Ok so my data is set up like this

    Client Account Number Payment
    ABCD 12345678 £20.00
    10203040 £40.00
    Total £60.00
    EFGH 12131415 £10.00
    16171819 £20.00
    17852654 £20.00
    Total £50.00

    Imagine that Client is Cell reference "A1". I need a code that will look at column A and if the cell is empty it will duplicate the writing from above so Cell "A2" will be duplicated into Cell "A3". I also need it to stop when it reaches the bottom of column A. The bottom will be signified by Cell value "**".

    The code I have so far is:

    Sub Duplicate_Client()

    Range("A2").Select
    If Not IsNull(ActiveCell.Value) Then ActiveCell = ActiveCell.Offset(-1, 0)
    ActiveCell.Offset(1, 0).Select
    Loop

    Application.ScreenUpdating = True

    End Sub

    Thanks

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Duplicate data from field above if cell is blank

    Please use code tags as per the forum rules.

    It's also much better to attach a sample workbook than to try and replicate your data structure within the post as it is often hard to visualise what it really looks like.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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