+ Reply to Thread
Results 1 to 3 of 3

Copy/Paste textboxes into alternate rows

Hybrid View

JoeVanGeaux Copy/Paste textboxes into... 03-07-2017, 12:51 AM
JoeVanGeaux Re: Copy/Paste textboxes into... 03-07-2017, 12:17 PM
JoeVanGeaux Re: Copy/Paste textboxes into... 03-07-2017, 04:55 PM
  1. #1
    Registered User
    Join Date
    02-03-2017
    Location
    SE Texas
    MS-Off Ver
    2013
    Posts
    98

    Copy/Paste textboxes into alternate rows

    In the attached sample file, I show the basic page layout where I am trying to add an empty textbox into the bottom portion of a cell in every other line which would then be indexed based on a cell in another worksheet. I found that I can copy and Paste Special (as a GIF) for each line, but this involves manually dragging the box into position.

    For only a few cells, this wouldn’t be a problem, but I have about 600 rows (1200 in all but I need to skip every other row). I searched the net and this forum’s archives but can’t find a solution to match or get close enough to my situation for me to experiment. Any suggestions?
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    02-03-2017
    Location
    SE Texas
    MS-Off Ver
    2013
    Posts
    98

    Re: Copy/Paste textboxes into alternate rows

    I found the code below and messed with it a bit and messed up my worksheet. If someone knows where I can make something encouraging show up on the screen that'd be a good a start (For now, I can't even consider what I tried a "start", yet!) Thanks for any suggestions, at all.

    Option Explicit
    
    Sub AddaTextBox()
        Dim mybox
        Dim top, left, height, width, margin
        margin = 20
        With ThisWorkbook.ActiveSheet.Shapes
            left = .Item(.Count).left
            top = .Item(.Count).top + .Item(.Count - 1).height + margin
            width = .Item(.Count).width
            height = .Item(.Count).height
        Set mybox = .addtextbox(msoTextOrientationHorizontal, left, top, width, height)
        End With
    End Sub

  3. #3
    Registered User
    Join Date
    02-03-2017
    Location
    SE Texas
    MS-Off Ver
    2013
    Posts
    98

    Re: Copy/Paste textboxes into alternate rows

    Having some success with code below. But can't get it to move to next row. (It does make many repeated inserts into same place, though.) The commented-out section works but this would mean I'd have to insert about 650 groups of code...twice, because I have a nearly identical second worksheet. I would then be able to tackle the "Selection.Formula" part afterwards.

    Private Sub InsertNewLinkedTextBoxes2()
    '
    '
    Dim c As Range
    Dim rng As Range
    Set rng = Selection
    
        For Each c In rng
            c = RowCount
            RowCount = RowCount + 1
                    
        'FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
            For i = 2 To 8 Step 2 'trying to limit range for now original code:"FinalRow Step 2"
        
                ActiveSheet.Shapes.Range(Array("TextBox 1")).Select
                Selection.Copy
                ActiveWindow.SmallScroll Down:=3
        
                Range("C5:G5").Select
                ActiveSheet.PasteSpecial Format:="Microsoft Office Drawing Object", Link:= _
                    False, DisplayAsIcon:=False
                Selection.ShapeRange.IncrementTop 137.25
                Selection.Formula = "=Sheet2!G5"
                ActiveWindow.SmallScroll Down:=3
                
            Next i
        Next
        
    '    Range("C7:G7").Select
    '    ActiveSheet.PasteSpecial Format:="Microsoft Office Drawing Object", Link:= _
    '        False, DisplayAsIcon:=False
    '    Selection.ShapeRange.IncrementTop 137.25
    '    Selection.Formula = "=Sheet2!G7"
    '    ActiveWindow.SmallScroll Down:=3
    '
    '    Range("C9:G9").Select
    '    ActiveSheet.PasteSpecial Format:="Microsoft Office Drawing Object", Link:= _
    '        False, DisplayAsIcon:=False
    '    Selection.ShapeRange.IncrementTop 137.25
    '    Selection.Formula = "=Sheet2!G9"
    '    Range("C9:G9").Select
        
    End Sub
    Attached Files Attached Files
    Last edited by JoeVanGeaux; 03-07-2017 at 04:57 PM. Reason: Forgot to include updated Workbook

+ 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. cut and paste alternate rows
    By jen0dorf in forum Excel General
    Replies: 7
    Last Post: 03-24-2016, 04:07 PM
  2. Copy paste userform textboxes to word
    By welshman010 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-28-2014, 10:45 PM
  3. Copy and paste based on multiple input/textboxes
    By siobeh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-06-2014, 08:43 PM
  4. Copy and paste specific range to date specific range in alternate sheet
    By alanalmarza in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-21-2013, 08:29 AM
  5. [SOLVED] paste in multiple alternate blank rows
    By system in forum Excel General
    Replies: 5
    Last Post: 10-15-2012, 03:30 PM
  6. Replies: 2
    Last Post: 02-22-2011, 02:07 AM
  7. Select alternate rows to copy
    By Christina in forum Excel General
    Replies: 4
    Last Post: 01-26-2005, 10:07 PM

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