+ Reply to Thread
Results 1 to 6 of 6

copy cells automatically to next blank cells in another sheet'

Hybrid 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

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: copy cells automatically to next blank cells in another sheet'

    You don't really need a macro for this.

    1) On the ORDER sheet, go to Tools > Options and turn off [x] Zero Values

    2) Formulas:

    C24: =Estimate!Q1
    D24: =Estimate!R1

    F24: =Estimate!Q21
    G24: =Estimate!R21

    I24: =Estimate!Q41
    J24: =Estimate!R41

    L24: =Estimate!Q61
    M24: =Estimate!R61

    3) Now copy all those formulas down.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

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

    Re: copy cells automatically to next blank cells in another sheet'

    Thanks but I need the macro to self fill the order sheet as it changes continuously and to know if we need more line at row N44 just like the first macro in my worksheet

  4. #4
    Registered User
    Join Date
    04-04-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: copy cells automatically to next blank cells in another sheet'

    Quote Originally Posted by slohman View Post
    Thanks but I need the macro to self fill the order sheet as it changes continuously and to know if we need more line at row N44 just like the first macro in my worksheet
    The formula that JBeaucaire provided will self fill as the other value changes, it just saves the need for a macro.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: copy cells automatically to next blank cells in another sheet'

    And in another cell you could put this formula to let you know when there is too much data:

    =IF(Estimate!Q81<>"", "More Data", "")

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: copy cells automatically to next blank cells in another sheet'

    If that takes care of your need, please click Thread Tools above your first post and mark this thread as SOLVED.

+ Reply to Thread

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