Results 1 to 10 of 10

Help! combining 2 VBA codes

Threaded View

  1. #1
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Help! combining 2 VBA codes

    How do I combined these 2 codes into one VBA code?

    The first code is a recorded macro

    Sub Macro1()
    '
    ' Macro1 Macro
    '
    
    '
        Rows("1:1").Select
        Selection.Delete Shift:=xlUp
        Columns("B:B").Select
        Selection.Delete Shift:=xlToLeft
        Columns("C:D").Select
        Selection.Delete Shift:=xlToLeft
        Columns("D:E").Select
        Selection.Delete Shift:=xlToLeft
        Columns("A:A").Select
        Selection.SpecialCells(xlCellTypeBlanks).Select
        Selection.FormulaR1C1 = "=R[-1]C"
        Columns("A:A").Select
        Selection.Copy
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Columns("B:B").Select
        Selection.SpecialCells(xlCellTypeBlanks).Select
        Application.CutCopyMode = False
        Selection.FormulaR1C1 = "=R[-1]C"
        Columns("B:B").Select
        Selection.Copy
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
    End Sub
    The second code is

    Sub deleteBlank()
        Dim Lastrow As Integer
        
        Lastrow = Range("B" & Rows.Count).End(xlUp).Row
        
        Range("C2:BC" & Lastrow).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    End Sub
    Last edited by iamreese; 03-29-2012 at 08:26 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