Results 1 to 5 of 5

How to repeat cell value x times in Excel?

Threaded View

  1. #1
    Registered User
    Join Date
    07-06-2015
    Location
    los angeles
    MS-Off Ver
    2013
    Posts
    4

    Question How to repeat cell value x times in Excel?

    Hi,

    I am looking to copy multiple cells by a specific number. In the formula found below it finds A1 and copies it by B1. I am looking for it to look at A1,B1,C1 and copy the amount in D1. Could anyone please assist in this?(I know it is probably simple and I am not see it).

    I have found this link which helped with the formula. Linkl

    Formula used:
    Sub CopyData()
    'Update 20140724
    Dim Rng As Range
    Dim InputRng As Range, OutRng As Range
    xTitleId = "KutoolsforExcel"
    Set InputRng = Application.Selection
    Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8)
    Set OutRng = Application.InputBox("Out put to (single cell):", xTitleId, Type:=8)
    Set OutRng = OutRng.Range("A1")
    For Each Rng In InputRng.Rows
        xValue = Rng.Range("A1").Value
        xNum = Rng.Range("B1").Value
        OutRng.Resize(xNum, 1).Value = xValue
        Set OutRng = OutRng.Offset(xNum, 0)
    Next
    End Sub
    Thank you in advance for your help.
    Last edited by davesexcel; 12-11-2021 at 08:07 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Modify a macro to repeat as many times as given cell value.
    By David Obeid in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-23-2015, 04:00 AM
  2. [SOLVED] How do you repeat a value x times then move on to the next cell below for the same?
    By a1c2014 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-18-2014, 06:46 PM
  3. Repeat cell values a certain number of times
    By strother1990 in forum Excel General
    Replies: 2
    Last Post: 09-24-2014, 12:43 PM
  4. Replies: 4
    Last Post: 03-08-2014, 08:01 AM
  5. Repeat a cell value in another column X number of times
    By art1234 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-31-2011, 02:36 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