Results 1 to 5 of 5

If cell is greater than X and less than Y input Z VBA

Threaded View

grlnexdor If cell is greater than X and... 05-19-2014, 01:25 AM
David A Coop Re: If cell is greater than X... 05-19-2014, 02:12 AM
grlnexdor Re: If cell is greater than X... 05-19-2014, 02:24 AM
humdingaling Re: If cell is greater than X... 05-19-2014, 02:46 AM
grlnexdor Re: If cell is greater than X... 05-19-2014, 03:58 AM
  1. #1
    Registered User
    Join Date
    08-11-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    28

    If cell is greater than X and less than Y input Z VBA

    Hi,

    Can someone take a look at my macro and let me know which part is wrong as only the "error" and the "30+" is coming out.



    Sub advancebooking()
    
    Dim lRow As Long
    
    Sheets("7raw").Select
    
    lRow = Range("t" & Rows.Count).End(xlUp).Row
    
    For i = 2 To lRow
    
        
        If Cells(i, 21) >= 0 And Cells(i, 54) <= 2 Then
            Cells(i, 62) = "0-02"
        ElseIf Cells(i, 20) >= 3 And Cells(i, 54) <= 7 Then
            Cells(i, 62) = "3-07"
        ElseIf Cells(i, 20) >= 8 And Cells(i, 54) <= 14 Then
            Cells(i, 62) = "8-14"
        ElseIf Cells(i, 20) >= 15 And Cells(i, 54) <= 21 Then
            Cells(i, 62) = "15-21"
        ElseIf Cells(i, 20) >= 22 And Cells(i, 54) <= 30 Then
            Cells(i, 62) = "22-30"
        Else
            Cells(i, 62) = "30+"
        End If
    
    Next i
    
    End Sub


    Thanks in advance!
    Attached Files Attached Files
    Last edited by grlnexdor; 05-19-2014 at 03:44 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] IF input is greater or less than certain value change a cell's formula
    By Adriandiaz101 in forum Excel General
    Replies: 3
    Last Post: 03-26-2014, 05:02 PM
  2. Replies: 2
    Last Post: 10-08-2012, 08:10 AM
  3. Replies: 2
    Last Post: 04-29-2012, 06:29 AM
  4. Replies: 4
    Last Post: 10-18-2011, 02:54 PM
  5. Formula/function to input value when greater than more than 2
    By oliverhj in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-14-2009, 09:17 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