Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA - delete hidden column in mergence status

I want to delete the hidden columns with following scripts

Sub Macro7()
For i = 65 To 80
temp = Chr(i) & ":" & Chr(i)
Columns(temp).Select
bTEST = Selection.EntireColumn.Hidden
If bTEST = True Then
Selection.Delete Shift:=xlToLeft
i = i - 1
End If
Next
End Sub

It can work when no mergence. But if D3:H3 cells are merged, and Colum
E is hidden, the loop goes to Columns("E:E"), the property feeds back i
still "False", in that case, the hidden column E can't be delet
correctly.

Pls help out, ^_^

seang

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Excel VBA - delete hidden column in mergence status

Don't use merged cells ... that's the best advice I can give you.

In this particular case, you can probably solve your problem by skipping the
Select step and using Columns(temp) instead of Selection in the next two
steps.

--

Vasant

"seangu " wrote in message
...
I want to delete the hidden columns with following scripts

Sub Macro7()
For i = 65 To 80
temp = Chr(i) & ":" & Chr(i)
Columns(temp).Select
bTEST = Selection.EntireColumn.Hidden
If bTEST = True Then
Selection.Delete Shift:=xlToLeft
i = i - 1
End If
Next
End Sub

It can work when no mergence. But if D3:H3 cells are merged, and Column
E is hidden, the loop goes to Columns("E:E"), the property feeds back is
still "False", in that case, the hidden column E can't be delete
correctly.

Pls help out, ^_^

seangu


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA - delete hidden column in mergence status

thank you!
As you said, the problem is the selection.
Right now, i have change to column(temp).delete, it's working now.


---
Message posted from http://www.ExcelForum.com/

Reply
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
Checking Column Status on closing excel - Macro Needed Pankaj Excel Discussion (Misc queries) 2 September 4th 09 10:32 PM
2007 Worksheet, Hidden Columns, .CSV Format Saves Hidden Column Da Tammy Excel Discussion (Misc queries) 3 April 2nd 09 11:40 PM
How can I delete Excel rows that I've hidden without restoring the Ian@DSL Excel Discussion (Misc queries) 2 September 12th 07 08:51 PM
How do I delete hidden character in Excel? Isa Excel Discussion (Misc queries) 3 November 15th 05 04:29 PM
Check status row (hidden or visible)? Martin Los Excel Programming 1 December 18th 03 03:32 PM


All times are GMT +1. The time now is 02:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"