Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Find Blank Cells and List Each Cell Address in Another Sheet

Hello Experts! I used the macro recorder to find and color all blank cells
in a used range in my worksheet. It is easy to do by firing up the recorder,
hitting Ctrl + g, ckicking Special, selecting Blanks, and filling in the
blanks with a color. I am wondering if there is a way to do something
similar, but identify the blanks cells by each respective cell address, and
put all of these in some kind of summary sheet. For instance, clicking the
commandbutton would result in a Summary sheet being created and all blank
cells would be listed by cells address, such as $D$5, $F$14, $J$92...if these
cells are blank.

Any ideas?

Kind Regards,
Ryan---


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Find Blank Cells and List Each Cell Address in Another Sheet

Dim r as Range, cell as Range
Dim rw as Long
On Error resume Next
set r = cells.Specialcells(xlBlanks)
On error goto 0
if not r is nothing then
for each cell in r
rw = rw + 1
worksheets("Sheet2").Cells(rw,1).Value = cell.Address
Next
End if

this assumes you don't have more than 8192 discontiguous areas of blank
cells.

--
Regards,
Tom Ogilvy

"ryguy7272" wrote:

Hello Experts! I used the macro recorder to find and color all blank cells
in a used range in my worksheet. It is easy to do by firing up the recorder,
hitting Ctrl + g, ckicking Special, selecting Blanks, and filling in the
blanks with a color. I am wondering if there is a way to do something
similar, but identify the blanks cells by each respective cell address, and
put all of these in some kind of summary sheet. For instance, clicking the
commandbutton would result in a Summary sheet being created and all blank
cells would be listed by cells address, such as $D$5, $F$14, $J$92...if these
cells are blank.

Any ideas?

Kind Regards,
Ryan---


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Find Blank Cells and List Each Cell Address in Another Sheet

Sub FindBlanks()
Dim rngBlanks As Range
Dim rngToPaste As Range
Dim rng As Range

On Error Resume Next
Set rngBlanks = Cells.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0

If Not rngBlanks Is Nothing Then
Set rngToPaste = Sheets("Summary").Range("A2")
For Each rng In rngBlanks
rngToPaste.Value = rng.Address
Set rngToPaste = rngToPaste.Offset(1, 0)
Next rng
End If
End Sub
--
HTH...

Jim Thomlinson


"ryguy7272" wrote:

Hello Experts! I used the macro recorder to find and color all blank cells
in a used range in my worksheet. It is easy to do by firing up the recorder,
hitting Ctrl + g, ckicking Special, selecting Blanks, and filling in the
blanks with a color. I am wondering if there is a way to do something
similar, but identify the blanks cells by each respective cell address, and
put all of these in some kind of summary sheet. For instance, clicking the
commandbutton would result in a Summary sheet being created and all blank
cells would be listed by cells address, such as $D$5, $F$14, $J$92...if these
cells are blank.

Any ideas?

Kind Regards,
Ryan---


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Find Blank Cells and List Each Cell Address in Another Sheet

I'm not sure if there is a function that converts column numbers to letters,
so I had to add the code myself. the code would be much simplier if the
columns appear as lettters. is assumed you want column lettters?

Sub test()

RowCount = 1
first = True
For Each cell In Selection
If IsEmpty(cell) Then
If first = True Then
Worksheets.Add
ActiveSheet.Name = "Summary"
first = False
End If
ColNumber = cell.Column
Col1stNumber = Int((ColNumber - 1) / 26)
Col2ndNumber = (ColNumber - 1) Mod 26
ColLettter = Chr(Asc("A") + Col2ndNumber)
If Col1stNumber < 0 Then
ColLettter = Chr(Asc("A") + (Col1stNumber - 1)) & _
ColLettter
Else

End If
Sheets("Summary").Cells(RowCount, "A") = _
ColLettter & cell.Row
RowCount = RowCount + 1
End If
Next cell

End Sub

"ryguy7272" wrote:

Hello Experts! I used the macro recorder to find and color all blank cells
in a used range in my worksheet. It is easy to do by firing up the recorder,
hitting Ctrl + g, ckicking Special, selecting Blanks, and filling in the
blanks with a color. I am wondering if there is a way to do something
similar, but identify the blanks cells by each respective cell address, and
put all of these in some kind of summary sheet. For instance, clicking the
commandbutton would result in a Summary sheet being created and all blank
cells would be listed by cells address, such as $D$5, $F$14, $J$92...if these
cells are blank.

Any ideas?

Kind Regards,
Ryan---


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Find Blank Cells and List Each Cell Address in Another Sheet

This is unreal! Exactly what I was thinking of!!! Tom, please tell me, did
you have this code saved away somewhere, or did you just create it after you
read my post?

Thanks so much.

Ryan---


"Tom Ogilvy" wrote:

Dim r as Range, cell as Range
Dim rw as Long
On Error resume Next
set r = cells.Specialcells(xlBlanks)
On error goto 0
if not r is nothing then
for each cell in r
rw = rw + 1
worksheets("Sheet2").Cells(rw,1).Value = cell.Address
Next
End if

this assumes you don't have more than 8192 discontiguous areas of blank
cells.

--
Regards,
Tom Ogilvy

"ryguy7272" wrote:

Hello Experts! I used the macro recorder to find and color all blank cells
in a used range in my worksheet. It is easy to do by firing up the recorder,
hitting Ctrl + g, ckicking Special, selecting Blanks, and filling in the
blanks with a color. I am wondering if there is a way to do something
similar, but identify the blanks cells by each respective cell address, and
put all of these in some kind of summary sheet. For instance, clicking the
commandbutton would result in a Summary sheet being created and all blank
cells would be listed by cells address, such as $D$5, $F$14, $J$92...if these
cells are blank.

Any ideas?

Kind Regards,
Ryan---


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help Taking alot data from one sheet (if not blank) and copying toa list on another sheet. Alex Zuniga Excel Worksheet Functions 1 November 25th 09 11:54 PM
how can I find cell/s in excel sheet having blank spaces more tha. Excel blank cells with spaces Excel Discussion (Misc queries) 1 August 25th 08 12:54 PM
Start Cell B1 then find first blank cell, insert subtotal, next non blank, then next blank, sutotal cells in between......... [email protected][_2_] Excel Programming 2 June 7th 07 09:27 PM
Return Address of Blank Cells in MsgBox Sandy Excel Programming 4 August 25th 05 02:06 PM
Help! Formula to find the address of particular value in sheet xcelion Excel Worksheet Functions 2 July 13th 05 12:41 PM


All times are GMT +1. The time now is 04:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"