Consulting

Results 1 to 7 of 7

Thread: Copying range value without cellformula

  1. #1
    VBAX Tutor
    Joined
    Mar 2009
    Posts
    227
    Location

    Copying range value without cellformula

    Ive got this code to copy a set of rows into columns in the next page....but the cells i'm copying contain formula so its not showing up on the next page, I need the cell.values copied without the formula...
    how do i do that?

    thanks a bunch






    [VBA]

    Sub GridData()
    Dim iCol As Long
    Dim iOff As Long

    'Application.ScreenUpdating = False

    With Worksheets("art")


    For iCol = 0 To 7

    For iOff = 0 To 7

    Worksheets("data").Cells(6, 8 * iCol + iOff + 3).Resize(3).Copy _
    Worksheets("art").Cells(6 + iOff * 3, iCol + 3).Resize(3)
    Next iOff


    Next iCol
    End With

    Application.ScreenUpdating = True
    End Sub
    [/VBA]

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

    Sub GridData()
    Dim iCol As Long
    Dim iOff As Long

    'Application.ScreenUpdating = False

    With Worksheets("art")


    For iCol = 0 To 7

    For iOff = 0 To 7

    Worksheets("data").Cells(6, 8 * iCol + iOff + 3).Resize(3).Copy
    Worksheets("art").Cells(6 + iOff * 3, iCol + 3).Resize(3).Paste xlPasteValues
    Next iOff
    Next iCol
    End With

    Application.ScreenUpdating = True
    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
    VBAX Tutor
    Joined
    Mar 2009
    Posts
    227
    Location
    hi xld, thanks for the code, but its giving me a 'runtime error 438'
    says Object doesnt support this property or method.

    clicking debug highlights the follow line of code

    [VBA]
    Worksheets("art").Cells(6 + iOff * 3, iCol + 3).Resize(3).Paste xlPasteValues
    [/VBA]

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Set the Paste target as the Top Left cell. No need to specify the whole range.
    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'

  5. #5
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    It should be PasteSpecial
    [VBA]
    .Cells(6 + iOff * 3, iCol + 3).PasteSpecial xlPasteValues

    [/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'

  6. #6
    VBAX Tutor
    Joined
    Mar 2009
    Posts
    227
    Location
    I tried this it didnt work

    [VBA]
    Worksheets("art").Range("C6").Paste xlPasteValues
    [/VBA]

  7. #7
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    See post #5
    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'

Posting Permissions

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