Results 1 to 12 of 12

Selective copying based on cell values

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Question Selective copying based on cell values

    Hi,
    This thread has emerged from my previous unsuccessful thread. I have changed my approach. Hope this time it will work.

    In sheet1, I am trying to copy Certain cells or rows based on cell value in column K ( K 200 :K 305) if the value is equal to 1.... The respective rows or cells to be copied are from M200: S305.
    These are to be pasted to same sheet at columns A to G in the next free row available.

    I have tried various things and they don't work....
    The code that I would use is as follows:

    Sub_CopyOnlyOne()
    
        Dim sourceRng As Range
        Dim cell As Range
        Dim i As Long
    
        Set sourceRng = ActiveSheet.Range("K200:K305")
        i = 1
    
        For Each cell In sourceRng
            If cell.Value = 1 Then
                cell.Resize(1, 5).Copy Destination:=Range("A76:G190" & i)
                'this is a problem area
                i = i + 1
            End If
        Next cell
    
    End Sub
    I have attached the book as well....
    Many thanks

    Regards
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Show the images based on the selective cell value
    By krishnakuma6 in forum Excel General
    Replies: 1
    Last Post: 11-12-2012, 06:21 AM
  2. Replies: 3
    Last Post: 06-06-2012, 05:36 AM
  3. Copying data to a table based on cell values
    By Miraun in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-27-2011, 09:19 AM
  4. Macro for copying and duplicating data based on a cell values.
    By outthere in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-25-2009, 12:31 PM
  5. How to add new data to existing cell based on multiple selective inputs?
    By AlphaSvn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2009, 06:08 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