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: 703
Default Work sheet hangs - help appreciated

On 12 Jun., 14:39, Kieran H wrote:
Hi,

XL2000 / WIN 2000

I am using the following code to remove unwanted columns from a
worksheet.

The worksheet is populated by serialized sp calls to a remote SQL
server. The regions are named as thay come in.

The code below checks the value in the column header of the first
named region
(steps through columns starting from the right hand side) and is
supposed to delete the entire column if a match is found.

Alas, what actually happens is the work sheet freezes.hangs - i.e I
cannot select a cell almost as if a modal form was open somewhere. and
I receive a message that the Method 'delete' of object range failed.

Info:

The worksheet is not locked
I have tried exporting all objects to new workbook
I have tried 'cleaning' project
Debug.Print Cell.Address will give the cell address I am expecting
There is no code running when work sheet is frozen
Named region definately exists
If I stop the code before the code below runs *- all is well *i.e. all
data correctly poulated & worksheet not frozen

Any help would be greatly aprreciated

Regards

Kieran

Public Function DeleteColumns()
Dim lCol As Long
Dim cell As Range

With Sheets("Data")
* *For lCol = .Range("RA_FY1).Columns.Count To 1 Step -1
* *Set cell = .Range("RA_FY1").Rows(1).Columns(lCol)
* * * Select Case LCase(cell.Value)
* * * * *Case "groupcode", "areaofworkcode", "top" * '......etc
* * * * * * cell.EntireColumn.Delete Shift:=xlShiftToLeft
* * * * *Case Else
* * * End Select
* Next
End With
Set Cell =Nothing
End Function


Hi

Try this:

Set cell= .cells(1, ICol)

Regards,
Per
 
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
Excel hangs when copying sheet with charts to Powerpoint TimS Excel Discussion (Misc queries) 2 November 12th 08 10:48 PM
Work sheet hangs - help appreciated Kieran H Excel Programming 6 June 12th 08 03:21 PM
Code into MS Object Sheet Hangs up donbowyer Excel Programming 8 December 30th 07 10:50 PM
calculating cells hangs when filtering ranges in a sheet WiFiMike2006 Excel Worksheet Functions 1 January 15th 07 11:47 PM
Excel macro convert to VBA - doesn't work, hangs on Range("Q35").Select Harold Good Excel Programming 3 January 13th 06 09:09 PM


All times are GMT +1. The time now is 07:03 PM.

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"