Results 1 to 5 of 5

Thread: With the help of macro how can I copy rows from one worksheet to another?

  1. #1
    Join Date
    Feb 2011
    Posts
    46

    With the help of macro how can I copy rows from one worksheet to another?

    I wonder if there is a macro that can run to make sure a spreadsheet. In this spreadsheet is a column in which the value should be "true." If this value is true, I would copy the complete row of data keen on another spreadsheet located on the server. There can be numerous rows of information where this situation is met. It is extremely urgent any help please .Any suggestions would be really respected. Thanks for your time.

  2. #2
    Join Date
    Jun 2009
    Posts
    1,518

    Re: With the help of macro how can I copy rows from one worksheet to another?

    Use this code:

    Code:
    Sub cond_copy()
        'assuming the data is in page 1
        Sheets("page 1").Select
        rowcount = Cells(Cells.Rows.Count, "b").End(xlUp).Row
        For i = 0 To rowcount
            'assuming the true statment is in column a
            Range("b" & j).Select
            check_value = ActiveCell
            If check_value = "True" Or check_value = "true" Then
                ActiveCell.EntireRow.Copy
                'assuming the data is in page 2 
                Sheets("page 2").Select
                rowcount = Cells(Cells.Rows.Count, "b").End(xlUp).Row
                Range("b" & rowcount + 0).Select
                ActiveSheet.Paste
                Sheets("page 1").Select
            End If
        Next
    End Sub

  3. #3
    Join Date
    Nov 2008
    Posts
    1,514

    Re: With the help of macro how can I copy rows from one worksheet to another?

    Hi,Should be fairly simple. Did you use the search ability to verify for earlier threads? There should be some. Here is a few code anyway use this code:
    Code:
    Sub copyrows()
    
       Dim tdmad As Range, cell As Object
        
        Set tdmad = Range("A0:A7") 'Substitute with the range which includes your True/False values
        
        For Each Cell In tdmad
        
            If IsEmpty(Cell) Then
            Exit Sub
            End If
            
            If Cell.Value = "True" Then
            Cell.EntireRow.Copy
            Page2.Select  'Substitute with your sheet
            ActiveSheet.Range("b56879").End(xlUp).Select
            Selection.Offset(1, 0).Select
            ActiveSheet.Paste
            End If
               
        Next
    
    End Sub

  4. #4
    Join Date
    Mar 2009
    Posts
    1,360

    Re: With the help of macro how can I copy rows from one worksheet to another?

    At present do not record the macro. Just physically autos filter and copy the filtered information to a new place. Observe help on auto filter if needed. One time or double if your autofilter technique is ok then you can record the macro. What I mean is
    • In the page press tools then go in macro and then select record macro
    • You allow the name and press ok
    • Comes up an icon for stop macro. Do not do something in that icon at the present.
    • At present you do your steps. autofilter copying and once more stopping the filter.
    • behind productively doing what you need to do. press stop macro icon
    • clear the filtered information you have copied in another page
    • and then press tools macro-macros and highlight the macro you have recorded {“it will be such as macaro1 or macro 2”}.
    • Then hit run on the right side.

  5. #5
    Join Date
    Nov 2008
    Posts
    1,259

    Re: With the help of macro how can I copy rows from one worksheet to another?

    Your recorded macro requires modifying. Possibly in the macro at what time you copy the clean information to target sheet this destination page remains as active page. So at what time you return the macro the destination page is the active page whereas basis sheet should be the active page. In its place of using the declaration active page use work pages. Activate in the macro (you have to always pinch the recorded macro.)

Similar Threads

  1. Macro to find the min value of the rows
    By Farzana in forum Windows Software
    Replies: 4
    Last Post: 27-05-2011, 07:29 AM
  2. How To Copy Rows having Colored Cells by Macro
    By dogaman in forum Windows Software
    Replies: 3
    Last Post: 16-11-2010, 03:23 AM
  3. Replies: 2
    Last Post: 09-07-2009, 08:57 AM
  4. Excel macro variable to delete rows
    By JPGargoyle in forum Windows Software
    Replies: 2
    Last Post: 22-06-2009, 11:26 AM
  5. Delete blank Rows and Columns in a Worksheet
    By monsitj in forum Windows Software
    Replies: 0
    Last Post: 05-01-2009, 10:32 AM

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
  •  
Page generated in 1,713,902,650.63135 seconds with 17 queries