View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Martin Krastev[_2_] Martin Krastev[_2_] is offline
external usenet poster
 
Posts: 20
Default Creating a new worksheet by checking for blank values in a range

Try this code:

Dim sh As Worksheet
Dim r As Range, rng As Range
Dim i As Integer

i = 1
Set rng = Selection ' get the selected range
Set sh = ActiveWorkbook.Sheets.Add ' add a new sheet
For Each r In rng 'iterate through all cells of rng
If r.Value = "" Then 'check if cell is empty
sh.Cells(i, 1).Value = r.Address ' write the empty cell address
in the new sheet
i = i + 1 'goto next row
End If
Next r


"Geoff" wrote:

Hello, I am trying to create a new worksheet from an existing range of
data (pivot table copy/pasted values). This idea is to scan this range
and identify where there are no, or blank, values in a cell and return
take the heading (row and column) value for the blank cell and paste
them into a new worksheet for each occurrance. I have an example below
with A through C as column headings and 1 through 3 as row headings....

A B C
1 4 5 6
2 4 6
3 5

Using this example, I would want the new worksheet to populate as
such....

3 A
2 B
3 C

This is basically a tool to identify each area where there is missing
data and populate a new worksheet with those areas.

Can anyone help? This is beyond my programming capabilities, which are
quite modest.

Many Thanks!
Geoff