+ Reply to Thread
Results 1 to 6 of 6

Repeat All Item Label in Excel 2007 -- Need Macro to do what Excel 2010 can do

Hybrid View

  1. #1
    Registered User
    Join Date
    02-19-2013
    Location
    Wisconsin, WI
    MS-Off Ver
    Excel 2007
    Posts
    37

    Repeat All Item Label in Excel 2007 -- Need Macro to do what Excel 2010 can do

    SampleDataLabel.xls

    What I am looking to accomplish.
    "Fill the Empty Cells Left by Pivot Table Row Fields"
    http://datapigtechnologies.com/blog/...le-row-fields/

    Long story short, company I work for is using Excel 2007 and won't be switching over to Excel 2010. Curious if there is a macro that will accomplish the same thing "Repeat All Item Label" in Excel 2010.

    Any suggestion is welcome! Thanks!

  2. #2
    Registered User
    Join Date
    02-19-2013
    Location
    Wisconsin, WI
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Repeat All Item Label in Excel 2007 -- Need Macro to do what Excel 2010 can do

    Bumping allowed?

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Repeat All Item Label in Excel 2007 -- Need Macro to do what Excel 2010 can do

    Select the range which contains the labels you want to replicate and then in the immediate window (ALT+F11 and then CTRL+G) use the following line.

    selection.specialcells(xlBlanks).formular1c1="=R[-1]C"
    It will not work on the pivot table, only a copied Copy-Paste Special-Values version.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Repeat All Item Label in Excel 2007 -- Need Macro to do what Excel 2010 can do

    Hi,

    Insert 3 columns. Now your data starts from column D.

    Put this formula in the Cell A2 and copy the same till C141.

    =IF(ISBLANK(D2),A1,D2)
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Repeat All Item Label in Excel 2007 -- Need Macro to do what Excel 2010 can do

    Code

    Sub UnmergeAndFillInTheBlanks()
    
        Dim cell As Range, LR As Long, rng As Range
        
        Const Colnum As String = "A:N"
            
        Application.ScreenUpdating = False
        Columns(Colnum).UnMerge
        LR = Cells.Find("*", , , , xlByRows, xlPrevious).Row
        Set rng = Intersect(Rows(2 & ":" & LR), Columns(Colnum))
        On Error Resume Next
        For Each cell In rng.SpecialCells(xlCellTypeBlanks).Cells
            cell.Value = cell.Rows(1).Offset(-1).Value
        Next
        Application.ScreenUpdating = True
    End Sub

  6. #6
    Registered User
    Join Date
    02-19-2013
    Location
    Wisconsin, WI
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Repeat All Item Label in Excel 2007 -- Need Macro to do what Excel 2010 can do

    Thank you AB33!! It worked!

+ 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