+ Reply to Thread
Results 1 to 12 of 12

Add row in 2 worksheets

Hybrid View

  1. #1
    Registered User
    Join Date
    10-16-2008
    Location
    Neza
    Posts
    10

    Add row in 2 worksheets

    Hi

    I need to add a row in tab "Clients", every time I have a new customer. Then I need to add that same row in another tab "Master". I tried using a macro but it copies the same row with the same information again and again.
    Basically i need to add a row, put in some info and that automatically the same row is added in another tab

    Hopefully someone can help me

    Thanks in advance
    Last edited by fezonio; 10-17-2008 at 02:02 PM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Why do you need to duplicate data, it is generally totally unnecessary. Where do you want to add the Row, attach a small example workbook.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    10-16-2008
    Location
    Neza
    Posts
    10
    Ok, I have a list iof customers and info in the tabs of Chi and Mex. In the tab Master I have a consolidation of all my data. The tab Master has a formula to modify automatically whatever changes I make in the other 2 tabs. However, when i add a new customer in Chi or Mex, I have to copy it and paste it in Master.
    Now imagine doing that when you have 10 worksheets and many many customers on them.

    Hope this helps
    Attached Files Attached Files

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You only need one sheet of data, you can easily use AutoFilter on the countries column

  5. #5
    Registered User
    Join Date
    10-16-2008
    Location
    Neza
    Posts
    10
    Sorry no, that doesn't quite help me. Perhaps I'm not being clear. When I add a new customer's info on Chi or Mex, I want Excel to copy all by itself, that very same info in the Master worksheet. Maybe using a button that says "Add new row" or something like that.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    What I am saying is that it is unnecessary, you could manage with one sheet of data. Why duplicate data? You could use something like this, it will copy the row of the selected cell

     Dim R      As Long
        With Sheet3
            R = .Cells(Rows.Count, 1).End(xlUp) + 1
            ActiveCell.EntireRow.Copy .Cells(R, 1)
        End With

  7. #7
    Registered User
    Join Date
    10-16-2008
    Location
    Neza
    Posts
    10
    Sorry but could you also help me in telling where should I copy the code?? I am really not good por VBA programming

    Thanks

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You need to add a Standard Module in the VB Editor using the Insert menu, then add

    Sub copyRow{}
     Dim R      As Long
        With Sheet3
            R = .Cells(Rows.Count, 1).End(xlUp) + 1
            ActiveCell.EntireRow.Copy .Cells(R, 1)
        End With
    End Sub
    Close the VB Editor

    Finally add a button on the sheets from the Forms Menu, right click & Assign Macro.

  9. #9
    Registered User
    Join Date
    10-16-2008
    Location
    Neza
    Posts
    10
    Thanks, but it has an run-time error '13': Type mismatch
    In the debug, it marks in yellow: R = .Cells(Rows.Count, 1).End(xlUp) + 1

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Sorry I missed a bit
    R = .Cells(Rows.Count, 1).End(xlUp).Row + 1

  11. #11
    Registered User
    Join Date
    10-16-2008
    Location
    Neza
    Posts
    10
    Thanks roy, I mean really thanks, it works perfectly.
    Thanks again man

    greetings from mexico

  12. #12
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    No problem, please mark the question Solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Concatenate across multiple worksheets based on variable
    By rpatton1 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-09-2008, 03:35 PM
  2. Automatically format multiple worksheets
    By Kez in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-29-2008, 08:25 AM
  3. Looping through worksheets in a workbook to pull data
    By fecurtis in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-02-2008, 01:40 PM
  4. Deleting worksheets, printing to Adobe, and moving to a new workbook
    By baconcow in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-22-2008, 10:03 AM
  5. Selecting worksheets in a workbook based on criteria
    By josnah in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-13-2008, 10:47 AM

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