+ Reply to Thread
Results 1 to 3 of 3

Copy/Paste formulas across multiple sheets

  1. #1
    Registered User
    Join Date
    11-30-2012
    Location
    alberta, canada
    MS-Off Ver
    Excel 2010
    Posts
    39

    Copy/Paste formulas across multiple sheets

    Good day all,

    I seem to be having trouble with a code I am writing that will:
    1) Check the value of Cell(A1) to see if it even needs to copy formulas
    2) If Cell(A1) has the correct value to then copy the formula in Cell(B2) and paste it on to Cells(B2:'x'y')
    3) Move on to the next Sheet in the workbook

    I am still learning vba so I am very often screw up basics.

    This is what I have been trying:
    Please Login or Register  to view this content.
    It is telling me "Run-time Error '424': Object Required" And highlights the line:
    Please Login or Register  to view this content.
    Any ideas would be very helpful.
    Last edited by Sleepyshy; 12-18-2012 at 07:42 PM.

  2. #2
    Forum Contributor
    Join Date
    03-21-2012
    Location
    Ho Chi Minh city
    MS-Off Ver
    Excel 2003
    Posts
    180

    Re: Copy/Paste formulas across multiple sheets

    PHP Code: 
    Option Explicit
    Sub FillFormulas
    ()
     
    Dim i As Long:                     Dim Sh As Variant

     
    For Each Sh In ThisWorkbook.Worksheets
        With Sh
            
    If .Range("A1").Value 1 Then
                
    .Range("B2").Copy
                
    .Range("B2:FA300").PasteSpecial xlPasteFormulas
            
    Else
                
    MsgBox Sh.Name
            End 
    If
        
    End With
     Next Sh
    End Sub 

  3. #3
    Registered User
    Join Date
    11-30-2012
    Location
    alberta, canada
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Copy/Paste formulas across multiple sheets

    Works Perfectly!

    Thanks a bunch. Was just wondering what Option Explicit does?

    Either way, Have a great day and thanks again.

    Sleepyshy

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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