+ Reply to Thread
Results 1 to 10 of 10

Copy one value from a particular position into a varying number of cells & repeat

  1. #1
    Registered User
    Join Date
    08-30-2014
    Location
    United States
    MS-Off Ver
    Windows 2013 and Mac 2011
    Posts
    3

    Copy one value from a particular position into a varying number of cells & repeat

    In essence, I would like to change this:

    Please Login or Register  to view this content.
    to this:

    Please Login or Register  to view this content.
    "1", "2", "3", "4" are just column numbers. They are not present in the actual spreadsheet.

    Each dot represents a piece of data that must be kept as is. "A", "B", and "C" are the same across the entire spreadsheet and are present 2 rows below the V value in every case. The V1, V2, V3, etc. are all different from each other. The V values are just text and spaces, no numbers. Notice that there are 2 blank rows between the end of a V series and the beginning of another. There is only 1 blank row between the V value and "A", "B", and "C". The dot values in Column 2 are dates (formatted as text) in the form of "Aug. 1", "Sep. 10", "Oct. 20", "Nov. 30", etc. You may find that helpful.

    I essentially just want to copy the V value from its cell in Column 2 into the cells and rows in Column 1 in which there are dots. There's about 300 V values. The number of rows within a V series is not constant, but is generally close to 10.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy one value from a particular position into a varying number of cells & repeat

    Hi WiFi,

    Try:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    08-30-2014
    Location
    United States
    MS-Off Ver
    Windows 2013 and Mac 2011
    Posts
    3

    Re: Copy one value from a particular position into a varying number of cells & repeat

    That does not work. The error message is:

    Please Login or Register  to view this content.
    The debug message points to this line:
    Please Login or Register  to view this content.
    Please keep in mind that the V1, V2, etc. aren't actually "V1", "V2", etc. They're actually a bit of text that varies in name (i.e. "Apple Pie", "Car Maker", "Laptop", etc.). Deleting the "V" from "V*" in your code causes the same error to be thrown.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: Copy one value from a particular position into a varying number of cells & repeat

    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Copy one value from a particular position into a varying number of cells & repeat

    answer to OP post, try
    Please Login or Register  to view this content.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy one value from a particular position into a varying number of cells & repeat

    @ wifi - so, what is true in your example??

  7. #7
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Copy one value from a particular position into a varying number of cells & repeat

    A message to forum cross posters

    Please read this:
    http://www.excelguru.ca/node/7
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  8. #8
    Registered User
    Join Date
    08-30-2014
    Location
    United States
    MS-Off Ver
    Windows 2013 and Mac 2011
    Posts
    3

    Re: Copy one value from a particular position into a varying number of cells & repeat

    Quote Originally Posted by kalak View Post
    answer to OP post, try
    Please Login or Register  to view this content.
    This solution works perfectly for me!

  9. #9
    Registered User
    Join Date
    08-30-2014
    Location
    United States
    MS-Off Ver
    Windows 2013 and Mac 2011
    Posts
    3

    Re: Copy one value from a particular position into a varying number of cells & repeat

    Quote Originally Posted by xladept View Post
    @ wifi - so, what is true in your example??
    I'm not quite sure what you mean. But, regardless, a solution has been found.

  10. #10
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Copy one value from a particular position into a varying number of cells & repeat

    Thanks for the feedback.

    That solution relies on there being at least one space between each V* (or whatever is there) and the next A (or whatever that is) and also at least one space between the bottom dot in Col B in each group and the next V.
    If these spaces are not there then the code won't work.
    Last edited by kalak; 08-31-2014 at 05:58 PM.

  11. #11
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy one value from a particular position into a varying number of cells & repeat

    @kalak - thanks for the description!

+ 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. VBA Copy a Varying Number of Whole Rows
    By nosheal in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-22-2014, 12:28 PM
  2. [SOLVED] Macro to copy varying number of cells
    By socalobie in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-20-2014, 03:58 AM
  3. [SOLVED] Macro to copy three cells to varying number of rows
    By socalobie in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-20-2014, 12:45 AM
  4. SUM on varying number of cells in VBA
    By mathmani in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-19-2013, 09:46 AM
  5. Sum total for varying number of cells
    By peri1224 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-30-2009, 12:34 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