Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Copy down problem (2003)

    I created a report in another program (Cognos8) and saved it as Excel. The report was grouped so I was using the following macro to fill in the blanks.
    Sub FillBlanks2()
    Dim rng As Range
    On Error Resume Next
    Set rng = ActiveSheet.UsedRange.Columns("A:C")
    With rng
    .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
    .Copy
    .PasteSpecial xlPasteValues
    End With
    Set rng = Nothing

    End Sub

    When I manually copy down the data, no problem but when I use the macro, I get
    Sheetz, Inc.
    =R[-1]C
    =R[-1]C
    =R[-1]C
    =R[-1]C
    =R[-1]C

    I know it has something to do with the program I saved it from. I had to unmerge the columns that has the data I want to copy down from. I use this macro all the time on my excel files. This is a new reporting program that we are using and it sucks to say the least.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Copy down problem (2003)

    I suspect that the cells are formatted as text, so anything entered into them is seen as literal text. Try this:

    With rng
    .NumberFormat = "General"
    .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
    .Copy
    .PasteSpecial xlPasteValues
    End With

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy down problem (2003)

    Thanks Hans. That worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •