Results 1 to 2 of 2

Replace Empty With Zero using Macro

Threaded View

  1. #1
    Registered User
    Join Date
    12-19-2012
    Location
    perth
    MS-Off Ver
    Excel 2003
    Posts
    1

    Replace Empty With Zero using Macro

    Hi, guys working on excel spread sheet using macro to fill empty cells with 0 but the macro are deleting the formulas in the sheets.... can anyone help me please

    Sub ReplaceEmptyWithZero()
    '
    ' ReplaceEmptyWithZero Macro
    '
    
    '
        Sheets("USAGE").Select
        Range("B4:BA2009").Select
        Selection.SpecialCells(xlCellTypeBlanks).Select
        Selection.FormulaR1C1 = "0"
       
    End Sub
    Sub AddFigures()
    '
    ' AddFigures Makro
    ' Add StdDev, Ave, Sum, Max and Last 3 Month's Ave Weekly Usage
    '
    
    '
        Sheets("USAGE").Select
        ActiveWindow.ScrollColumn = 2
        ActiveWindow.ScrollColumn = 3
        ActiveWindow.ScrollColumn = 4
        ActiveWindow.ScrollColumn = 5
        ActiveWindow.ScrollColumn = 6
        ActiveWindow.ScrollColumn = 7
        ActiveWindow.ScrollColumn = 8
        ActiveWindow.ScrollColumn = 10
        ActiveWindow.ScrollColumn = 12
        ActiveWindow.ScrollColumn = 13
        ActiveWindow.ScrollColumn = 14
        ActiveWindow.ScrollColumn = 15
        ActiveWindow.ScrollColumn = 17
        ActiveWindow.ScrollColumn = 18
        ActiveWindow.ScrollColumn = 20
        ActiveWindow.ScrollColumn = 21
        ActiveWindow.ScrollColumn = 22
        ActiveWindow.ScrollColumn = 24
        ActiveWindow.ScrollColumn = 25
        ActiveWindow.ScrollColumn = 27
        ActiveWindow.ScrollColumn = 28
        ActiveWindow.SmallScroll ToRight:=22
        Range("BM5").Select
        ActiveCell.FormulaR1C1 = "STD DEV"
        Range("BN5").Select
        ActiveCell.FormulaR1C1 = "AVE"
        Range("BO5").Select
        ActiveCell.FormulaR1C1 = "SUM"
        Range("BP5").Select
        ActiveCell.FormulaR1C1 = "MAX"
        Range("BQ5").Select
        ActiveCell.FormulaR1C1 = "LAST 3mo weekly AVE"
        Range("BM7").Select
        ActiveWindow.SmallScroll Down:=-9
        ActiveCell.FormulaR1C1 = "=STDEV(RC[-63]:RC[-2])"
        Selection.AutoFill Destination:=Range("BM7:BM1666")
        Range("BM7:BM1666").Select
        Range("BN7").Select
        ActiveCell.FormulaR1C1 = "=AVERAGE(RC[-64]:RC[-3])"
        Range("BN7").Select
        Selection.AutoFill Destination:=Range("BN7:BN1666")
        Range("BN7:BN1666").Select
        Range("BO7").Select
        ActiveCell.FormulaR1C1 = "=SUM(RC[-65]:RC[-4])"
        Range("BO7").Select
        Selection.AutoFill Destination:=Range("BO7:BO1666")
        Range("BO7:BO1666").Select
        ActiveWindow.ScrollColumn = 33
        ActiveWindow.ScrollColumn = 34
        ActiveWindow.ScrollColumn = 35
        Range("BP7").Select
        ActiveCell.FormulaR1C1 = "=MAX(RC[-66]:RC[-5])"
        Range("BP8").Select
        ActiveWindow.ScrollColumn = 34
        ActiveWindow.ScrollColumn = 35
        Range("BP7").Select
        Selection.AutoFill Destination:=Range("BP7:BP1666")
        Range("BP7:BP1666").Select
        Range("BQ7").Select
        ActiveCell.FormulaR1C1 = "=AVERAGE(RC[-19]:RC[-6])"
        Range("BQ7").Select
        Selection.AutoFill Destination:=Range("BQ7:BQ1666")
        Range("BQ7:BQ1666").Select
    End Sub
    Moderator's Edit: Use code tags when posting code. To do so in future, select your code and click on the # icon at the top of your post window.
    Last edited by tau84; 12-20-2012 at 06:00 AM.

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