+ Reply to Thread
Results 1 to 3 of 3

copying 2 cells multiple times to a range

  1. #1
    Registered User
    Join Date
    05-15-2013
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2010
    Posts
    21

    copying 2 cells multiple times to a range

    Hello All,

    I am stuck in the last part of macro on copying 2 cells which contain an ID and Visit number to a range where the ID and Visit number need to be listed every time for each data line (the amount of data lines here will vary).
    Dim IDVisit As Range
    Dim CopyRange As Range
    Dim FinalRaw As Long
    Dim rngTemp As Range

    FinalRaw = wsR.Cells(Rows.Count, 5).End(xlUp).Cells

    Set IDVisit = wsO.Range(Cells(1, 3), Cells(1, 4))
    Set IDSPSS = wsR.Range(Cells(2, 1), Cells(FinalRaw, 1))

    For Counter = FinalRaw To 1 Step -1
    Set rngTemp = ID.Cells(FinalRaw)
    For i = 1 To FinalRaw
    IDSPSS.Value = rngTemp.Value
    Next
    Next
    End Sub

    I did this copying a post I saw. But I think this is more complicated than it needs to be. I basically need 2 cells copied multiple times on another workbook for each data line that is present.

    FYI. the workbooks etc. are already declared earlier in the Macro.

    Thanks in advance!

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: copying 2 cells multiple times to a range

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-15-2013
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: copying 2 cells multiple times to a range

    Thanks so much! That was so simple :/.

    One more question, how can I create a column thats values are just numbers in ascending order. So in this case I want numbers in ascending order starting at 1 starting at cell A2 and down the column until the Final Row.

    Thanks in advance!
    Alexis

+ 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