Consulting

Results 1 to 3 of 3

Thread: Solved: insert letter into blank cells

  1. #1
    VBAX Regular
    Joined
    Dec 2007
    Posts
    26
    Location

    Solved: insert letter into blank cells

    I have a range c2:g16. Some are filled with numbers and the others are just blank cells. I would like a macro that will insert a letter A into the blank cells. Thank you.

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    You can use the macro recorder as a starting point (Macro1)

    BUT you always need to clean up the recorded code (Macro1_Editied) to make it more efficient and maintainable

    [VBA]
    Sub Macro1()
    Range("C2:G16").Select
    Selection.SpecialCells(xlCellTypeBlanks).Select
    Selection.FormulaR1C1 = "A"
    Range("C2").Select
    End Sub

    Sub Macro1_edited()
    On Error Resume Next
    ActiveSheet.Range("C2:G16").SpecialCells(xlCellTypeBlanks).Value = "A"
    On Error GoTo 0
    End Sub
    [/VBA]

    Paul

  3. #3
    VBAX Regular
    Joined
    Dec 2007
    Posts
    26
    Location
    That worked. Thanks.

Posting Permissions

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