+ Reply to Thread
Results 1 to 10 of 10

How to repeat a cell depending on a value in another sheet

  1. #1
    Forum Contributor
    Join Date
    11-12-2012
    Location
    Jeddah, Saudi Arabia
    MS-Off Ver
    2010, 2013, 2016, Office 365
    Posts
    507

    How to repeat a cell depending on a value in another sheet

    Hi,

    I have the following data in the workbook as below

    Sheet1
    Airfare Tickets Provision
    Basic Salary
    Basic Salary Deduction
    Car Insurance Loan Repayment
    Car Loan Repayment
    Cash Loan Repayment

    Sheet2
    ABCBC
    BCDCD
    CDEDE
    DEFEF
    EFGFG
    FGHGH

    I need the following result in another sheet as follows

    Column A Column B
    Airfare Tickets Provision ABCBC
    Basic Salary ABCBC
    Basic Salary Deduction ABCBC
    Car Insurance Loan Repayment ABCBC
    Car Loan Repayment ABCBC
    Cash Loan Repayment ABCBC
    Airfare Tickets Provision BCDCD
    Basic Salary BCDCD
    Basic Salary Deduction BCDCD
    Car Insurance Loan Repayment BCDCD
    Car Loan Repayment BCDCD
    Cash Loan Repayment BCDCD
    Airfare Tickets Provision CDEDE
    Basic Salary CDEDE
    Basic Salary Deduction CDEDE
    Car Insurance Loan Repayment CDEDE
    Car Loan Repayment CDEDE
    Cash Loan Repayment CDEDE

    Regards,
    Barieq

  2. #2
    Registered User
    Join Date
    07-28-2015
    Location
    Pruszków, Poland
    MS-Off Ver
    365 Business
    Posts
    58

    Re: How to repeat a cell depending on a value in another sheet

    Try the attachment
    Attached Files Attached Files

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: How to repeat a cell depending on a value in another sheet

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Forum Contributor
    Join Date
    11-12-2012
    Location
    Jeddah, Saudi Arabia
    MS-Off Ver
    2010, 2013, 2016, Office 365
    Posts
    507

    Re: How to repeat a cell depending on a value in another sheet

    Thank you Patronus & Sixthsense.

    Sorry for the late reply, I was out of office. Patronus code is working perfectly, but when I run Sixthsense code it's showing the error.

    .Range("B" & n).Value = vCode(i)

    Sorry I was unable to upload the file.

    Regards,
    Barieq

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to repeat a cell depending on a value in another sheet

    SS's code works too. You might have the sheet names mixed up.

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    11-12-2012
    Location
    Jeddah, Saudi Arabia
    MS-Off Ver
    2010, 2013, 2016, Office 365
    Posts
    507
    Thanks, I have not noticed that.

    Quote Originally Posted by AB33 View Post
    SS's code works too. You might have the sheet names mixed up.

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    11-12-2012
    Location
    Jeddah, Saudi Arabia
    MS-Off Ver
    2010, 2013, 2016, Office 365
    Posts
    507

    Re: How to repeat a cell depending on a value in another sheet

    Hi AB33,

    I have changed the Sheet names as per your code but still the code displays error Subscript out of Range. Can you please check.

    Regards,
    Barieq
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to repeat a cell depending on a value in another sheet

    Yes, you will keep getting an error because the way the array loop is constructed. You need to loop through the range as Patronus's code used.

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: How to repeat a cell depending on a value in another sheet

    Here's my understanding.
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    11-12-2012
    Location
    Jeddah, Saudi Arabia
    MS-Off Ver
    2010, 2013, 2016, Office 365
    Posts
    507

    Re: How to repeat a cell depending on a value in another sheet

    Thanks jindon, Solved.

+ 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. Replies: 2
    Last Post: 04-27-2014, 06:39 PM
  2. [SOLVED] Repeat Names on a list depending on how many visits
    By Dave69rock in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-25-2013, 04:17 PM
  3. [SOLVED] Copy cell from 1 sheet to another sheet depending on what info is displayed in a cell
    By chilli76 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-24-2013, 12:33 PM
  4. How to repeat vba code a number of times depending on items in an excel list
    By qaliq in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-18-2013, 08:13 AM
  5. Repeat value depending on number of entries in another range
    By Sally Rose in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-27-2013, 10:48 AM
  6. Repeat rows depending on a certain cell value
    By abokhadiga in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-03-2010, 05:13 AM
  7. Repeat value in the same cell on each sheet
    By Katherine in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-15-2005, 02:06 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