Results 1 to 6 of 6

copy cells automatically to next blank cells in another sheet'

Threaded View

  1. #1
    Registered User
    Join Date
    03-25-2012
    Location
    Melbourne, Victoria
    MS-Off Ver
    Excel 2007
    Posts
    82

    copy cells automatically to next blank cells in another sheet'

    Can someone tell me how to run a macro I have a worksheet named estimate which is the data and value and they are in rows Q and R I wish to run the macro to put the data in worksheet named order.

    The date is start in C24 then skip across to I24 and the values to start at F24 and skip across to L24 not going past N24 and then jumping the this down to C25 etc etc.

    I have put a macro in for the data but can't figure out how to do the value? and maybe join the macro's together.

    Can anybody help

    Sub MoveEstimate_to_Order()
    Dim i As Long
    Dim LR As Long
    Dim MyCol As Integer
    Dim MyRow As Integer
    
    LR = Sheets("Estimate").Range("Q" & Rows.Count).End(xlUp).row
    MyCol = 6
    MyRow = 24
        For i = 1 To LR
            If Sheets("Estimate").Range("R" & i).Value <> "" Then
                Sheets("Order").Cells(MyRow, MyCol).Value = Sheets("Estimate").Range("R" & i).Value
                MyCol = MyCol + 2
                    If MyCol = 14 Then
                        MyCol = 2
                        MyRow = MyRow + 1
                    End If
                If MyRow = 44 Then
                    MsgBox "You have ran out of room.  Some entries were not copied"
                    Exit For
                End If
            End If
        Next i
    End Sub
    This is what I have so far but if you run the macro it is not working properly.
    test1.xls
    Last edited by davesexcel; 04-02-2012 at 06:47 AM. Reason: code tags required, please read the Foum Rules

Thread Information

Users Browsing this Thread

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

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