View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
joel joel is offline
external usenet poster
 
Posts: 9,101
Default VBA - Run time error when modules combined???

the may be some data that is corrupted on the worksheet. Here is a quick way
I somtimes fix these problems.

Go to the row after you last row and click the row number. Then press
Shift-Cntl and press the down arrow so all the rows are highlighted. Then
right click any of the highlighted row numbers and select delete. Then do
the same thing for you columns.

If the above doesn't work then copy you data to a new worksheet. Delete the
old worksheet and rename the name the new worksheet the same as the old
worksheet.

"Madduck" wrote:

Thanks Joel..

I like what you've done there...
I do love the learning that comes with VB scripting :)

I have updated the code... I am at a loss though, I still get the error ...

I have found if I open the spreadsheet and just run that subroutine it
works.. if I close and do it again, it works, if I try a third time it gives
me the Run-time error....

Also if I run any other module before doing it it seems to error more
often...

Do you think this could be a memory issue as opposed to a coding issue?



"Joel" wrote:

Here is how I would write the code (see below). I avoid the select method
like you did below. I specifically reference each sheet and range as
required to avoid mistakes like you jusdt made.