Results 1 to 2 of 2

Thread: Need code to run across an Array of sheets

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Oct 2004
    Posts
    65
    Location

    Need code to run across an Array of sheets

    Hi,

    I have this code that I put together it's not very pretty but it gets the job done

    Now what I need to do is have this run across specific sheets in a workbook (not all of them) the sheets will always have the same name so what I can;t figure out how to do is run on sheet1 sheet2 etc. I was thinking of using an array of sheet names and loop but honestly this is bit beyond my skills

    Any help would be appreciated



    Sub Fix_Sheet()
    
    
    ' Cleans Raw data sheet
    '
    
    
    '
        Columns("E:E").Select
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Range("E1").Select
        ActiveCell.FormulaR1C1 = "Day"
        Range("E2").Select
        ActiveCell.FormulaR1C1 = "=TEXT(RC[-2],""ddd"")"
        Range("E2").Select
        Selection.AutoFill Destination:=Range("E2:E5000")
        Range("E2:E5000").Select
        Range("C1").Select
        ActiveCell.FormulaR1C1 = "Date"
        Columns("F:F").Select
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Range("F1").Select
        ActiveCell.FormulaR1C1 = "Interval"
        Range("F2").Select
        ActiveCell.FormulaR1C1 = "=(RC[1]/24)+(RC[2]/1440)"
        Range("F2").Select
        Selection.AutoFill Destination:=Range("F2:F5000")
        Range("F2:F5000").Select
        Columns("F:F").Select
        Selection.NumberFormat = "[$-409]h:mm AM/PM;@"
        
        Range("D1").Select
        ActiveCell.FormulaR1C1 = "lookup"
        Range("D2").Select
        ActiveCell.FormulaR1C1 = "=RC[-1]&RC[2]"
        Range("D2").Select
        Selection.AutoFill Destination:=Range("D2:D5000")
        Range("D2:D5000").Select
        
        
         Range("A1").Select
        ActiveCell.FormulaR1C1 = "WeekNum"
        Range("A2").Select
        ActiveCell.FormulaR1C1 = "=WEEKNUM(RC[+2])"
        Range("A2").Select
        Selection.AutoFill Destination:=Range("A2:A5000")
        Range("A2:A5000").Select
        Columns("A:A").Select
        Selection.NumberFormat = "#,##0"
        Columns("G:G").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
        ActiveSheet.UsedRange.Select
    
    
    End Sub
    Last edited by mduff; 12-10-2013 at 09:01 AM. Reason: Add code tags
    We are living in a world today
    where lemonade is made from
    artificial flavoring and furniture polish
    is made from real lemons...
    Alfred E Newman

Posting Permissions

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