Consulting

Results 1 to 9 of 9

Thread: macro help

  1. #1

    macro help

    i'm try to make a macro in excel 2007, which takes the data entered in the numbered tabs and paste special vales it in the summary sheet but a new/next free row each time. see attachment to help. once it copies it it wipes the data from the slave sheets.

    any help?

    cheers...

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Public Sub ProcessIt()
    Dim LastRow As Long

    With Worksheets("Summary")

    LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
    ActiveCell.EntireRow.Copy .Cells(LastRow + 1, "A")
    ActiveCell.EntireRow.ClearContents
    End With
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    unless i'm not running it correctly it doesnt work... only picked up the titles.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    It only move the row of the active cell on the selected sheet.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    i need the macro to run so the whole data fields moved, of all the sheets which start with a number...

  6. #6
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Why would you post a sample without data?

    [VBA]Option Explicit
    Sub Summary()
    Dim ws As Worksheet
    Dim i As Long, j As Long, rw As Long

    Set ws = Sheets("Summary")
    For j = 1 To 7
    rw = ws.Cells(Rows.Count, 1).End(xlUp).Row + 1
    For i = 1 To 7
    ws.Cells(rw, i).Value = Sheets(CStr(j)).Cells.Find(ws.Cells(1, i)).Offset(1).Value
    Sheets(CStr(j)).Cells.Find(ws.Cells(1, i)).Offset(1).ClearContents
    Next i
    Next j
    End Sub[/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  7. #7
    there was some data in it but i lost bits, it doesn't copy all of it, it stops at hours increase and the vba error is object variable or with block variable not set...

  8. #8
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Check the consistency of your sample.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  9. #9
    yep done, clever little macro

Posting Permissions

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