Advertisement

05.31.2008 at 12:24PM PDT, ID: 23447266
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.9

delete one extra row

Asked by keilah in Microsoft Excel Spreadsheet Software

Tags: , ,

Hi Experts

How would you make the current macro delete on extra row......in addtion to its current functionality..

here is the VBA Code:

Private Sub CommandButton1_Click()
Dim ws As Worksheet
Dim Sheet As New Collection
Dim rng As Range
Dim Finished As Boolean
Dim lastfound As Long
Dim rngRow As Long
Dim confirm As Boolean
Dim firstSupplierRow As Range
Dim lastSupplierRow As Range
Dim aSupplier As Range
Dim foundDemand As Boolean
    confirm = MsgBox("ARE YOU SURE YOU WANT TO DELETE SUPPLIER :> " & Me.Controls("combobox1").Text, vbYesNo, "Delete Supplier") = vbYes

    If confirm Then
        'Populate affected worksheets
        Sheet.Add ThisWorkbook.Worksheets("Deal Selection")
        Sheet.Add ThisWorkbook.Worksheets("Tables")
        Sheet.Add ThisWorkbook.Worksheets("Alloc (sc.1)")
        Sheet.Add ThisWorkbook.Worksheets("Alloc (sc.2)")
        Sheet.Add ThisWorkbook.Worksheets("Alloc (sc.3)")
        Sheet.Add ThisWorkbook.Worksheets("Modelling (Vol)")
        Sheet.Add ThisWorkbook.Worksheets("Allocation (Vol)")
        Sheet.Add ThisWorkbook.Worksheets("CashFlow Yearly")
        Sheet.Add ThisWorkbook.Worksheets("CashFlow Q4")
       
        For Each ws In Sheet
            If ws.Name = "Deal Selection" Then
                Set rng = ws.Range("B:B").Find(Me.Controls("combobox1").Text)
                rng.Resize(1, 6).Delete xlShiftUp
            ElseIf ws.Name = "Tables" Then
                Set rng = ws.Range("J:J").Find(Me.Controls("combobox1").Text)
                rng.Delete xlShiftUp
            ElseIf ws.Name = "CashFlow Q4" Then
                Set rng = ws.Range("B:B").Find(Me.Controls("combobox1").Text)
                lastfound = 1
                Finished = False
                Do While Not rng Is Nothing And Not Finished
                    rngRow = rng.Row
                    lastfound = rng.Row
                    Do While ws.Range("B" & rngRow) = Me.Controls("combobox1").Text
                        ws.Range("B" & rngRow).EntireRow.Delete
                    Loop
                    ws.Range("B" & rngRow).EntireRow.Delete
                    ' Delete this instance
'                    rng.EntireRow.Delete
                    Set rng = ws.Range("B:B").Find(Me.Controls("combobox1").Text)
                    Finished = rng Is Nothing
                Loop
                ws.Range("B" & ws.Rows.Count).End(xlUp).Resize(1, 52).Borders(xlBottom).Weight = xlMedium
                ws.Range("B" & ws.Rows.Count).End(xlUp).Borders(xlBottom).LineStyle = xlContinuous
            Else
                Set rng = ws.Range("B:B").Find(Me.Controls("combobox1").Text)
                lastfound = 1
                Finished = False
                Do While Not rng Is Nothing And Not Finished
                    rngRow = rng.Row
                    lastfound = rng.Row
                    Do While ws.Range("B" & rngRow) = Me.Controls("combobox1").Text
                        ws.Range("B" & rngRow).EntireRow.Delete
                    Loop
                    ' Delete this instance
'                    rng.EntireRow.Delete
                    Set rng = ws.Range("B:B").Find(Me.Controls("combobox1").Text)
                    Finished = rng Is Nothing
                Loop
                ws.Range("B" & ws.Rows.Count).End(xlUp).Resize(1, 52).Borders(xlBottom).Weight = xlMedium
                ws.Range("B" & ws.Rows.Count).End(xlUp).Borders(xlBottom).LineStyle = xlContinuous
            End If
        Next
    Else
   
        MsgBox Me.Controls("combobox1").Text & " - CUSTOMER NOT ADDED", , "USER CANCEL"
   
    End If
    Unload Me

End SubStart Free Trial
[+][-]05.31.2008 at 12:29PM PDT, ID: 21684812

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Excel Spreadsheet Software
Tags: microsoft, excel, 2003
Sign Up Now!
Solution Provided By: zorvek
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.31.2008 at 12:31PM PDT, ID: 21684819

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.31.2008 at 12:34PM PDT, ID: 21684830

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.31.2008 at 01:11PM PDT, ID: 21684922

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.31.2008 at 01:13PM PDT, ID: 21684927

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628