Solved

Excel VBA column Null Color RED

Posted on 2011-09-12
2
267 Views
Last Modified: 2012-05-12
I have a macro that copies sheet1 to sheet2.  

How would you say, after the macro finishes that

 "If column Z is null, then color column Z RED?"
0
Comment
Question by:ca1358
2 Comments
 
LVL 14

Accepted Solution

by:
peetjh earned 500 total points
ID: 36525656
Try the attached code
Sub checkcolumnZ()
Dim lastrow As Long
lastrow = [z65536].End(xlUp).Row
If lastrow = 1 Then
    If Cells(lastrow, "Z").Value = "" Then
        Columns(26).Interior.ColorIndex = 3
        Else
        Columns(26).Interior.ColorIndex = 0
    End If
End If
End Sub

Open in new window

0
 

Author Closing Comment

by:ca1358
ID: 36529642
Thank you
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now