Consulting

Results 1 to 8 of 8

Thread: (Help) Moving row with the macro

  1. #1
    VBAX Regular
    Joined
    Aug 2013
    Posts
    56
    Location

    (Help) Moving row with the macro

    Hi to everyone!

    I need help... These are the rows of my spreadsheet:

    st.jpg

    So what I what is that the macro add the last row (just like the existing ones) moving down, keeping the formatting (and functions) but with clean cells.
    Then in another macro, I would like to save data from all existing rows to another spreadsheet.

    I appreciate a lot some help!

    Thanks!

  2. #2
    VBAX Mentor
    Joined
    Jul 2012
    Posts
    398
    Location
    attach please a sample file (xlsx) with dummy data, not empty
    Last edited by patel; 08-23-2013 at 12:40 AM.

  3. #3
    VBAX Regular
    Joined
    Aug 2013
    Posts
    56
    Location
    program2.xlsx

    Done

    Help please!

  4. #4
    VBAX Regular
    Joined
    Aug 2013
    Posts
    56
    Location
    what I need is that the macro add the last row (just like the existing ones) moving down, keeping the formatting (and functions) but with clean cells.
    Then in another macro, I would like to save data from all existing rows to another spreadsheet.

  5. #5
    VBAX Mentor
    Joined
    Jul 2012
    Posts
    398
    Location
    Sub add1()
    With Sheets("Production")
      LR = .Cells(.Rows.Count, "C").End(xlUp).Row
      .Rows(LR + 1).Insert
      .Range("B" & LR & ":M" & LR + 1).FillDown
      .Range("B" & LR + 1 & ":M" & LR + 1).SpecialCells(2).ClearContents
    
    End With
    End Sub

  6. #6
    VBAX Regular
    Joined
    Aug 2013
    Posts
    56
    Location
    Thanks for the reply!
    Unfortunately this is not possible due to the fact that when we create a combo box we will need to select a cell link, so it's complicated to program a macro to always select different links cell. Then I decided that there are 9 rows to fill with data:
    program3.xlsx

    And now I would like to save the data from 9 rows to another spreadsheet, but I would just like to save the rows with data... anyone knows?

    Another problem, I can't copy the data selected from the combo box paste into another spreadsheet...

    Can anyone help me?

  7. #7
    VBAX Tutor david000's Avatar
    Joined
    Mar 2007
    Location
    Chicago
    Posts
    276
    Location
    On the Data sheet consider using a dynamic Data Validation list. This way you can copy the values straight from the sheet. Unless you are using the index of those combo boxes for something you didn't specify here.

    Named Range:
    =OFFSET(Data!$A$2,1,0,COUNTA(Data!$A:$A)-1,1)
    Data Validation > List > Source = Named Range

    This just copies the whole table over to the next sheet.

    Sub copy_resize_tester()
    Plan3.Range("b3").Resize(Cells(Rows.Count, "b").End(xlUp).Row - 2, Cells(3, Columns.Count).End(xlToLeft).Column - 1).Copy
    Sheet1.Range("a3").PasteSpecial xlPasteValues
    Application.CutCopyMode = False
    End Sub
    "To a man with a hammer everything looks like a nail." - Mark Twain

  8. #8
    VBAX Regular
    Joined
    Aug 2013
    Posts
    56
    Location
    That helped me a lot, thank you!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •