LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Detect missing rows

Hi,

I've written a function "CopyFromCell" (see below) that essentially copies a
value from one cell to another, but with a feature.
I use it to copy a source table to a destination table in a worksheet. The
destination table always has the same number of rows (1-12 months), but the
source table does not always contain that many rows (months).
This is the trick; if there is a matching row(month) in the source table,
copy the value, otherwise use 0 (zero).

Public Function CopyFromCell(SourceCell As Range, MonthCell As Range) As
Variant
Set matchingMonthCell = Range("SourceMonths").Find(MonthCell.value,
LookIn:=xlValues, LookAt:=xlWhole)
If Not matchingMonthCell Is Nothing Then
CopyFromCell = SourceCell
Else
CopyFromCell = 0
End If
End Function

This works fine initially, when the source and destination tables match.
However, if I delete a row in the source table, I get a #REF! in the
destination table, since it references a cell that has just been deleted. How
do I get around this? I can still put the cursor on the desired position (say
B35) in the excel sheet.


 
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
Use Advanced Filter to Detect non blank rows Connie Excel Discussion (Misc queries) 0 October 19th 06 09:40 PM
How to detect excess rows in txt or csv files before opening? 39N 95W Excel Programming 3 December 21st 05 08:19 PM
How to detect excess rows in txt or csv files before opening? 39N 95W Excel Programming 0 December 21st 05 04:59 PM
How to detect and view more than 65,536 rows when opening a DBF 42N83W Excel Programming 1 December 11th 05 01:39 PM
how to detect added or deleted rows in compare helpwithXL Excel Programming 1 April 29th 05 01:48 PM


All times are GMT +1. The time now is 08:12 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"