+ Reply to Thread
Results 1 to 7 of 7

Copy cells based on multiple cell values

  1. #1
    Registered User
    Join Date
    10-28-2011
    Location
    uk
    MS-Off Ver
    Excel 2003
    Posts
    24

    Copy cells based on multiple cell values

    Afternoon all.

    Need a bit of help here, I am quite new to VBA and not very good at it either.

    I will try and explain what I need as best I can. Please refer to the attached spreadsheet.

    In column A I have a list of pipes.( Column A is Upstream and B is Downstream)
    In columns G H I ...... etc. are points at which these pipes are split up.

    I basically have to work out chainage.

    In column AV is a list of the number of times they have to be split up.
    So for example

    1 means I only have to reference that pipe 1.
    2 means twice : therefore i need two rows in a column. Ideally the first row will have the pipe reference and the second will be blank.
    3: 3 rows etc etc



    So in short I need a vba to copy and paste a cell the amount of times as listed in column AV.

    Any ideas?

    Thanks for your help!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Copy cells based on multiple cell values

    You mean this?
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-28-2011
    Location
    uk
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Copy cells based on multiple cell values

    Not sure if my reply worked.

    But I said thanks for that nearly worked perfectly. But it puts an extra row in.
    So wehre i have count 1 I want it to stay.
    count 2 inserts 1 extra.
    count 3 inserts 2 extra.
    Thanks for the quick reply

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Copy cells based on multiple cell values

    Sub macro_1()
    Dim count
    For count = Range("A" & Rows.count).End(xlUp).Row To 3 Step -1
    Rows(count + 1 & ":" & count + Range("AV" & count)).Insert
    Rows(count).delete
    Next
    End Sub

  5. #5
    Registered User
    Join Date
    10-28-2011
    Location
    uk
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Copy cells based on multiple cell values

    Umm. that just deleted everything

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Copy cells based on multiple cell values

    ha oops
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-28-2011
    Location
    uk
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Copy cells based on multiple cell values

    You beautiful person !!!
    Now the next job. There will probably be another thread by me in about an hour once I start struggling with that bit too!!!

+ 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. Set multiple values of one cell based on other multiple cells
    By slix86 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-20-2013, 06:30 AM
  2. copy rows based on multiple cell values
    By stevenwhite1968 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-21-2011, 07:18 AM
  3. copy multiple rows and sort based on cell values
    By stevenwhite1968 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-18-2011, 03:12 AM
  4. Copy multiple cells based on another cell's value
    By vedranc in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-18-2010, 06:00 PM
  5. Formatting multiple cells based on cell values
    By BananaTang in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-14-2008, 10:31 AM

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