Closed Thread
Results 1 to 12 of 12

cut+paste formulas+formats to other cells

Hybrid View

  1. #1
    colwyn
    Guest

    cut+paste formulas+formats to other cells

    I've got two pieces of code.
    1. cuts+pastes all formulas and formats to another location.
    2. cuts+pastes required formulas but not cell formats to another location.

    The s/s is over 330,000 rows deep which makes manual changes impossible.

    I attach small s/s containing both codes.

    What I want to do is copy+paste formulas+formats from cells having a number in the cell below to cells 4 columns along and two rows down. The s/s illustrates this.

    Can anyone help please?
    Big thanks.
    Colwyn.
    Last edited by colwyn; 11-18-2008 at 01:46 PM.

  2. #2
    colwyn
    Guest

    re above post

    Can anyone help with this one please?
    Big thanks.
    Colwyn.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Youur example doesn't explain clearly.

    You want formulas moving from F to J but offset 4 rows. I don't understand why the two macros
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    colwyn
    Guest

    royUK - your post

    royUK thanks. Sorry. The two macros are previous attempts at code. I've left them in to try and better illustrate my needs.

    If you ignore them, what I want to do is get code which will do the following:

    go down column F and cut only those formulas+formats which are followed by a number in the next cell down and paste them 4 column along and 2 rows down.

    So in the attachment I would want formulas and formats to be moved from F3 and F15 to cells J5 and J17.

    Macro2 cuts and pastes the correct formulas but doesn't copy the formats.
    Macro1 does transfer formats but also cut/pastes ALL formulas (including cell F14).
    That's my present problem.

    Big thanks.
    Colwyn.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Like this?
    Option Explicit
    
    Sub copyFormulas()
        Dim cl     As Range
        Dim R      As Long
        Dim Rw     As Long
    
        Application.ScreenUpdating = False
        With Sheets("Sheet1")
            R = .Cells(.Rows.Count, 6).End(xlUp).Row
            For Rw = 3 To R
                If .Cells(Rw, 6).HasFormula And IsNumeric(.Cells(Rw, 5)) Then
                    .Cells(Rw, 6).Copy .Cells(Rw + 2, 10)
                    .Cells(Rw, 6).ClearContents
                End If
            Next Rw
        End With
        Application.ScreenUpdating = True
    End Sub

  6. #6
    colwyn
    Guest
    royUK - it does what macro1 does. It cut+pastes F14 which I want to avoid.
    I only want to cut+paste those formulas+formats which are followed by a number in the next cell down.
    Big thanks.
    Colwyn.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    This misses Row14

    Sub copyFormulas()
        Dim cl     As Range
        Dim R      As Long
        Dim Rw     As Long
    
        Application.ScreenUpdating = False
        With Sheets("Sheet1")
            R = .Cells(.Rows.Count, 6).End(xlUp).Row
            For Rw = 3 To R
            If Rw = 14 Then GoTo skip
                If .Cells(Rw, 6).HasFormula And IsNumeric(.Cells(Rw, 5)) Then
                    .Cells(Rw, 6).Copy .Cells(Rw + 2, 10)
                    .Cells(Rw, 6).ClearContents
                End If
    skip:
            Next Rw
        End With
        Application.ScreenUpdating = True
    End Sub

Closed Thread

Thread Information

Users Browsing this Thread

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

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