+ Reply to Thread
Results 1 to 8 of 8

Offset_formualcells_two rows_

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Offset_formualcells_two rows_

    Hi ,

    Wondering if some once code help me doing small modifications on the below code . and I am my requirement is I want the code to search the cells that has formula in particular column (X) and identifies the formula cells and offset to 2 rows .


    Sub Findformulacells()
    
    Dim x As Range
    Set x = ActiveSheet.Cells.Find.SpecialCells(xlCellTypeFormulas).LookIn:=xlFormulas
    
        If Not x Is Nothing Then
             x.Offset(, 2).Value = x.Value
             x.Clear
        End If
    Set x = Nothing
    End Sub
    Please find attached example file for your reference .
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: Offset_formualcells_two rows_

    Do you want it?

    Sub zz()
        Dim rng As Range
        Selection.SpecialCells(xlCellTypeFormulas, 23).Select
        For Each rng In Selection
            rng.Cut rng.Offset(, 2)
        Next
    End Sub

  3. #3
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: Offset_formualcells_two rows_

    Hi mate .. this is great.. can it be possible i want the code to be execute only in certain row lets say .

    only in column" A ".

  4. #4
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: Offset_formualcells_two rows_

    Just change line 3 as:
    Columns(which you want).SpecialCells(xlCellTypeFormulas, 23).Select
    For ex: Columns("A:A").SpecialCells(xlCellTypeFormulas, 23).Select

  5. #5
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: Offset_formualcells_two rows_

    Sorry mate :
    I tried with the below code it does not fetch the results . its giving object error .

    Sub zz()
        Dim rng As Range
        Selection.SpecialCells(xlCellTypeFormulas, 23).Select
         rng = Columns("A:A").SpecialCells(xlCellTypeFormulas, 23).Select
         rng.Cut rng.Offset(, 2)
            
        End Sub

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Offset_formualcells_two rows_

    Maybe:

    Sub hudsonandrewzzz()
        Dim rng As Range
        Columns(1).SpecialCells(xlCellTypeFormulas, 23).Select
        For Each rng In Selection
            rng.Offset(, 2).Formula = rng.Formula
            rng.ClearContents
        Next
    End Sub

  7. #7
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: Offset_formualcells_two rows_

    thanks john....

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Offset_formualcells_two rows_

    Your welcome, Hudson.

+ Reply to 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