Results 1 to 12 of 12

Paste values only to visible rows

Threaded View

  1. #1
    Registered User
    Join Date
    09-11-2015
    Location
    Santa Ana. CA
    MS-Off Ver
    2013
    Posts
    6

    Cool Paste values only to visible rows

    Hi All,

    I'm using VBA to copy and paste user selected cells from one workbook to another. The target workbook is filtered and I'm only pasting to the visible rows. The problem I'm having is I don't know how to make it so I'm only pasting the values. I don't want formulas, formats, etc. to be copied over to the target cells. It would be very much appreciated if you could add the fix to my existing code. I hope someone can help.

    Sub PasteToVisibleRows2()
    
    Dim rFrom As Range, rTo As Range
    Dim i As Long, Ofset As Long
    
    Dim RngCopySelection As Range
    Set RngCopySelection = Application.InputBox("Please select copy area", "Area Selection", , , , , , 8)
    
    Dim RngPasteSelection As Range
    Set RngPasteSelection = Application.InputBox("Please select paste area", "Area Selection", , , , , , 8)
    
    Set rFrom = RngCopySelection
    Set rTo = RngPasteSelection
    
    For i = 1 To rFrom.Rows.Count
    Do Until Not rTo.Offset(Ofset).Rows.Hidden
    Ofset = Ofset + 1
    Loop
    rFrom.Rows(i).Copy Destination:=rTo.Offset(Ofset)
    Ofset = Ofset + 1
    Next i
    Last edited by alpharay; 09-12-2015 at 12:37 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copy and Paste VISIBLE rows not hidden
    By booney440 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-09-2015, 08:03 AM
  2. Replies: 3
    Last Post: 04-09-2015, 07:42 PM
  3. Replies: 4
    Last Post: 01-27-2015, 10:48 PM
  4. Replies: 3
    Last Post: 04-11-2013, 04:13 AM
  5. Use visible rows from autofilter to build Pivot table. Or use visible rows to Copy/Paste
    By mwhitedesigns in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2012, 10:34 AM
  6. Copy Visible cells and paste values only to visible target cells
    By wotadude in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-28-2010, 04:09 AM
  7. Resize Visible Rows based only on Visible Columns text
    By Zimbo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-22-2009, 10:55 AM

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