Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Easy Excel Macro Question

  • 01-09-2010 10:09am
    #1
    Registered Users, Registered Users 2 Posts: 214 ✭✭


    Hi, I am new to macros and still trying to figure them out, hence the easy question! I have the following macro to delete rows where a certain column is empty. I want to change it to delete if it is empty or 0. See I told you it was easy! Can you use || for or and if so what is the context. Thanks.

    Sub Macro1()
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual 'pre XL97 xlManual
    Dim Rng As Range, ix As Long
    Set Rng = Intersect(Range("N:N"), ActiveSheet.UsedRange)
    For ix = Rng.Count To 1 Step -1
    If Trim(Replace(Rng.Item(ix).Text, Chr(160), Chr(32))) = "" Then
    Rng.Item(ix).EntireRow.Delete
    End If
    Next
    done:
    Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True
    End Sub


Comments

  • Registered Users, Registered Users 2 Posts: 1,456 ✭✭✭FSL


    You just use OR but you need the complete statement e.g if a=b OR a=c not if a=b OR C (note when typing 'or' it is not case sensitive)


  • Registered Users, Registered Users 2 Posts: 214 ✭✭PinkChick


    Thanks! That worked :-) So obvious now.

    Do you know anything about conditional formatting? I want to make txt bold and red if the cell doesn't say TRUE and is greater than 1. Not working out for me though :-(


Advertisement