Consulting

Results 1 to 6 of 6

Thread: Solved: Copy Formula from cell above and Paste only values: help required

  1. #1

    Solved: Copy Formula from cell above and Paste only values: help required

    Hi,

    I need a code, which will copy formula from given cell reference and paste the values to entire correspoding cells

    Attached is sample file with the requirement.

    kindly help.
    Attached Files Attached Files

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

    lastrow = .Range("A3").End(xlDown).Row
    With .Range("D4").Resize(lastrow - 3)

    ActiveSheet.Range("D2").Copy .Cells
    .Value = .Value
    End With
    End With
    [/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
    Hi Xld,

    awesome, this code is working fine.

    thank you very much for your help.

    Regards,

  4. #4
    hi
    Can we have small modification, Formula should be copied if the cell value is blank

    Regards

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [VBA]Dim lastrow
    With ActiveSheet

    lastrow = .Range("A3").End(xlDown).Row
    With .Range("D4").Resize(lastrow - 3).SpecialCells(xlCellTypeBlanks)

    ActiveSheet.Range("D2").Copy .Cells
    .Value = .Value
    End With
    End With[/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

  6. #6
    Hi Xld,

    its working fine as intended. As your profile tag line states you are "Distinguished Lord of VBAX"

    Regards

Posting Permissions

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