Results 1 to 8 of 8

Need help to combine to VBA Statements

Threaded View

  1. #1
    Registered User
    Join Date
    06-03-2013
    Location
    Matamoros, Mexico
    MS-Off Ver
    Excel 2007
    Posts
    52

    Lightbulb Need help to combine to VBA Statements

    Hello everyone. This is my second post and I need your help with this two VBA Statements.

    By surfing the forum, I found this VBA Code that help me to delete rows with specific text which is entered in Dialog Box (See Code below).


    Sub DeleteRows()
    Dim c As Range
    Dim SrchRng As Range
    Dim SrchStr As String

    Set SrchRng = ActiveSheet.Range("C1", ActiveSheet.Range("C65536").End(xlUp))
    SrchStr = InputBox("Please Enter A Search location to delete")
    Do
    Set c = SrchRng.Find(SrchStr, LookIn:=xlValues)
    If Not c Is Nothing Then c.EntireRow.Delete
    Loop While Not c Is Nothing
    End Sub



    With the second code (cortesy of oeldere) it helps me to align miscontinued rows of data (See code below):

    Sub filldata_decending_incolumnA()

    'from below to the top (decending)

    Range(Range("I2:O2"), Cells(Rows.Count, 9).End(xlUp).Offset(, -1)). _
    SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[1]C"
    With Columns("I:O")
    .Value = .Value
    End With

    With Columns("A").SpecialCells(xlCellTypeBlanks).Cells
    .EntireRow.Delete shift:=xlUp
    End With
    If Err.Number <> 0 Then MsgBox "There are no or only empty cells"

    End Sub



    Can anyone help me to combine this two VBA Codes into a single one?? I am practically new in VBA Codes. I know is not only Copy-Paste and done. I know that programming needs references to start and end with the first statement and continue with next and end it. So this is why I ask for your help.

    i am attaching a file to test the new combined VBA code. I will really appreciate the big favor and your ideas.

    Sam Cruz.
    Matamoros, Mexico.
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Can I combine 3 IF statements into one?
    By Mike7591 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-24-2013, 11:58 AM
  2. Need to combine several IF statements together
    By SumTuck in forum Excel General
    Replies: 7
    Last Post: 06-12-2012, 12:25 PM
  3. Combine two IF statements
    By dpask in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-07-2011, 04:41 PM
  4. combine several IF statements
    By inkansun in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2010, 08:24 AM
  5. Combine 2 If statements
    By m1066189 in forum Excel General
    Replies: 2
    Last Post: 06-23-2010, 07:58 PM

Tags for this Thread

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