Solved

Excel macro help

Posted on 2015-02-18
4
100 Views
Last Modified: 2015-03-04
Hi ,

I am working on a build sheet where we will be doing checks manually now.
I need your help to automate the 3 tasks.

1. Spell check
2. Highlight rows which dont have any plots. (In the attached row 4 has no plots)
3. Highlight columns which have unique plots.(in the attached column F and H has unique plots)

For spell check , i find the below macro online from excel tricks. but i need your help on adding the task2 and 3 with this macro.
Sub ColorMispelledCells()
For Each cl In ActiveSheet.UsedRange
If Not Application.CheckSpelling(Word:=cl.Text) Then _
cl.Interior.ColorIndex = 28
Next cl
End Sub

The attached is only sample and the column/row may be varied.

Thanks
0
Comment
Question by:magento
  • 3
4 Comments
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 40618266
No attachment
0
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 40618292
HI,

pls try

For Each rw In ActiveSheet.UsedRange.Rows
    Debug.Print Application.CountA(rw)
    If Application.CountA(rw) = 0 Then
        rw.Interior.ColorIndex = 28
    End If
Next rw
For Each cl In ActiveSheet.UsedRange.Columns
    If Application.CountA(cl) = 1 Then
        cl.Interior.ColorIndex = 28
    End If
Next rw

Open in new window

Regards
0
 
LVL 5

Author Comment

by:magento
ID: 40618304
Sorry , Please find the attachment .
plot-ee.xlsx
0
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40618329
Hi,

pls try

Sub Macro()

Set myRange = Range(Range("F3"), Cells(Range("E" & Rows.Count).End(xlUp).Row, Cells(1, Columns.Count).End(xlToLeft).Column))
For Each rw In myRange.Rows
    Debug.Print Application.CountA(rw)
    If Application.CountA(rw) = 0 Then
        rw.Interior.ColorIndex = 20
    End If
Next rw
For Each cl In myRange.Columns
    If Application.CountA(cl) = 0 Then
        cl.Interior.ColorIndex = 20
    End If
Next

End Sub

Open in new window

Regards EDIT Variable number of cols
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

785 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