View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Finding the end of Data

In the previous message, you had converted the formulas to values. So
xlcelltypeformulas won't find anything.

If you change the code to drop the .value = .value line or change to look for
constants, then you'll want to explain what doesn't work.

Jim Berglund wrote:

Dave, thanks for your comments. I will incorporate them in the future

I'm still learning. This is the first code I've written in a couple of
years.

BTW, I've tried to modify the following code, but it still doesn't get me to
the bottom of the rows in E with "#N/A" in them. (I'm trying to copy the top
block of cells into another worksheet). What's missing, please?

Dim wb As Workbook
Dim n As Long
Dim i As Integer
Dim myErrorRng As Range

Application.ScreenUpdating = False
i = 1

Set wb = ThisWorkbook
Set wsNumFrum = wb.Worksheets("Numbers From Reverse Directory")
Set wsCallList = wb.Worksheets("Call List")

n = wsNumFrum.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious).Row

'Dave Peterson's suggestions on copying the rows I want
With wsNumFrum
Set myErrorRng = Nothing
On Error Resume Next
Set myErrorRng = .Range("E:E") _
.Cells.SpecialCells(xlCellTypeFormulas, xlErrors)
On Error GoTo 0

If myErrorRng Is Nothing Then
MsgBox "No cells with constant errors in them"
Else
myErrorRng.Offset(0, -4).Copy
With wsCallList
'Copy and paste the data into the Call List
Application.CutCopyMode = False
wsCallList.Activate
Range(Cells(i, 1)).Select
ActiveSheet.Paste
i = i + 1
End With
End If
End With

Jim

"Dave Peterson" wrote in message
...
ps. Just a general note.

You may find that your coding life gets lots easier if you use
mnemonically
significant names.

Instead of:
dim ws4 as worksheet
you could use:
Dim wsRevDirNums as worksheet

Then when you're reviewing/updating your code (especially in 6 months!),
you
won't have to go back to figure out what ws1, ws2, ... are.

ps. And the qualifying the range stuff. I bet the reason you have
ws#.activate
and application.goto in your code is because you were getting errors.
Excel/VBA
knows where those unqualified ranges are (the activesheet). And instead
of
adjusting the code, it was easier to .activate a worksheet.

It's never a bad idea to qualify every range object.


--

Dave Peterson