• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Code for deduct last row and copy n paste formulas

Tom22

Member
Hi,

I am looking for a vba code which deduct blank cell in col c and then copy & paste formulas mention in above rows till its last row.
File is attached for your reference.

Thanks in advance
 

Attachments

  • Book1.xlsm
    12.1 KB · Views: 2
Hi !​
A demonstration as a beginner starter :​
Code:
Sub Demo1()
    With [Main!A1].CurrentRegion
        If Application.CountBlank(.Columns("C:E")) Then .Range("C2:E2").AutoFill .Range("C2:E" & .Rows.Count)
    End With
End Sub
Do you like it ? So thanks to click on bottom right Like !
 
Hi Marc L...it is working fine in the test file which I attached but no in my original file. Error msg says object required and when I debud it highlight first line of code.

I have changed Main! A1 with Pivot Raw! A1 (my original file tab)

and then reference to columns.

not sure what is missing here.

Code:
Sub Formulas()
    With [Pivot Raw!A1].CurrentRegion
        If Application.CountBlank(.Columns("EA:EP")) Then .Range("EA2:EP2").AutoFill .Range("EA2:EP" & .Rows.Count)
    End With
End Sub
 
Last edited by a moderator:
Yes it is working fine....we just need to change tab name to one word only...I changed it to Raw only and it is working...thanks a lot Marc :)
 
The correct syntax for Pivot Raw worksheet name is ['Pivot Raw'!A1] like you can easily see within a cell formula …​
 
Back
Top