Results 1 to 3 of 3

Code wont work if the first cells are empty

Threaded View

  1. #1
    Registered User
    Join Date
    06-05-2016
    Location
    England
    MS-Off Ver
    2013
    Posts
    7

    Code wont work if the first cells are empty

    Hello there,

    I have this code and it doesn't work when for instance its starts at row 6 but cells 6,7,8,9 are empty the code won't work and won't cycle through the rest of them.

    Is there a way to fix this?
    Private Sub Worksheet_Activate()
    Dim rowNumber As Long
    Dim thisSheet As Worksheet
    Dim cellToCheck As Range
    Dim LLName As String
    Dim LFName As String
    Dim LTitle As String
    Dim LResponse As Integer
    Set thisSheet = ActiveSheet
    rowNumber = 6
        Do Until thisSheet.Cells(rowNumber, 14).Value = vbNullString
            Set cellToCheck = thisSheet.Cells(rowNumber, 14)
                If cellToCheck.Interior.ColorIndex = xlColorIndexNone Then
                If cellToCheck.Value = DateAdd("d", -1, Date) Then
            LTitle = Sheets("Sheet1").Range("D" & rowNumber).Value
            LFName = Sheets("Sheet1").Range("E" & rowNumber).Value
            LLName = Sheets("Sheet1").Range("F" & rowNumber).Value
                LResponse = MsgBox("Did " & LTitle & " " & LFName & " " & LLName & " pass their course yesterday?", vbYesNoCancel, "Course")
                                If LResponse = vbYes Then
                    cellToCheck.Interior.Color = RGB(0, 255, 0)
               End If
               If LResponse = vbNo Then
                    cellToCheck.Interior.Color = RGB(255, 0, 0)
                    End If
                If LResponse = vbCancel Then
                Exit Sub
                End If
            End If
        End If
    rowNumber = rowNumber + 1
    Loop
    End Sub
    KJD
    Last edited by KyleJackDaniels; 06-08-2016 at 10:11 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Code wont work in new workbook
    By richard11153 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-28-2016, 05:37 PM
  2. Can someone help me, so this wont plot empty cells in chart?
    By horsefish01 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 12-10-2015, 03:26 AM
  3. VB code for multiple users and log ins - Just wont work!!!
    By qi86@hotmail.co.uk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-27-2014, 05:06 PM
  4. Running a code at a specific hour wont work if...
    By Joaoack in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-14-2012, 03:23 PM
  5. Unload and placement wont work in user form code
    By vn900 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-29-2011, 06:36 AM
  6. [SOLVED] Conditional formatting code wont work
    By Robert Hargreaves in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-05-2005, 09:40 PM
  7. [SOLVED] Why wont this code work?
    By Mark Stephens in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-30-2005, 02:06 PM

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