Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bec Bec is offline
external usenet poster
 
Posts: 15
Default Ignore First row

I am trying to delete some columns programmatically. I have been recording a
macro and then editing the code.

This is the code I am using:
Columns("E:G").Select
Range("E2").Activate
Selection.EntireColumn.Hidden = True

This works fine for the macro. When I go to rerun it, it fails. If I delete
the top merged heading row then it works. This heading gets automatically
created from another program so I can't delete it but I want my code to
ignore the top row when deleting the columns programmatically

I hope I am making myself clear. And I hope that someone can help me out.

Cheers
Bec
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Ignore First row

You can't hide just part of a column.............all or nothing


Gord Dibben MS Excel MVP

On Fri, 18 Jul 2008 08:28:01 -0700, Bec wrote:

I am trying to delete some columns programmatically. I have been recording a
macro and then editing the code.

This is the code I am using:
Columns("E:G").Select
Range("E2").Activate
Selection.EntireColumn.Hidden = True

This works fine for the macro. When I go to rerun it, it fails. If I delete
the top merged heading row then it works. This heading gets automatically
created from another program so I can't delete it but I want my code to
ignore the top row when deleting the columns programmatically

I hope I am making myself clear. And I hope that someone can help me out.

Cheers
Bec


  #3   Report Post  
Posted to microsoft.public.excel.programming
Bec Bec is offline
external usenet poster
 
Posts: 15
Default Ignore First row

I am trying to hide the entire column. It works fine when I record the macro.
No problem and I don't have to delete the top row. But when I run the macro
it doesn't work. It deletes all my columns. After hours or fiddling I tried
deleting the top row and running the macro again and it worked. But I can't
delete the top row generally as it keeps getting regenerated anyway. So I
need a way to run the macro with ignoring the top row.

It's weird because it does work when I first record the macro so obviously
excel knows to ignore the top row then just not when it reruns the macro



"Gord Dibben" wrote:

You can't hide just part of a column.............all or nothing


Gord Dibben MS Excel MVP

On Fri, 18 Jul 2008 08:28:01 -0700, Bec wrote:

I am trying to delete some columns programmatically. I have been recording a
macro and then editing the code.

This is the code I am using:
Columns("E:G").Select
Range("E2").Activate
Selection.EntireColumn.Hidden = True

This works fine for the macro. When I go to rerun it, it fails. If I delete
the top merged heading row then it works. This heading gets automatically
created from another program so I can't delete it but I want my code to
ignore the top row when deleting the columns programmatically

I hope I am making myself clear. And I hope that someone can help me out.

Cheers
Bec



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Ignore First row

Your code is not deleting columns, it is hiding Columns E through G

I guess I don't understand what you mean by "ignoring the top row".

When hiding or deleting columns you cannot ignore the top row or those columns.


Gord

On Fri, 18 Jul 2008 08:48:00 -0700, Bec wrote:

I am trying to hide the entire column. It works fine when I record the macro.
No problem and I don't have to delete the top row. But when I run the macro
it doesn't work. It deletes all my columns. After hours or fiddling I tried
deleting the top row and running the macro again and it worked. But I can't
delete the top row generally as it keeps getting regenerated anyway. So I
need a way to run the macro with ignoring the top row.

It's weird because it does work when I first record the macro so obviously
excel knows to ignore the top row then just not when it reruns the macro



"Gord Dibben" wrote:

You can't hide just part of a column.............all or nothing


Gord Dibben MS Excel MVP

On Fri, 18 Jul 2008 08:28:01 -0700, Bec wrote:

I am trying to delete some columns programmatically. I have been recording a
macro and then editing the code.

This is the code I am using:
Columns("E:G").Select
Range("E2").Activate
Selection.EntireColumn.Hidden = True

This works fine for the macro. When I go to rerun it, it fails. If I delete
the top merged heading row then it works. This heading gets automatically
created from another program so I can't delete it but I want my code to
ignore the top row when deleting the columns programmatically

I hope I am making myself clear. And I hope that someone can help me out.

Cheers
Bec




  #5   Report Post  
Posted to microsoft.public.excel.programming
Bec Bec is offline
external usenet poster
 
Posts: 15
Default Ignore First row

Hi Gord,

Apologies for teh confusion I did mean hide not delete. The problem is you
can actually do it. I can do it manually all the time and it performs fine
but as soon as you go to rerun what I've just recorded it doesn't work. So it
does in fact hide the column and ignore the first row when you do it manually
but not programmatically. That's the bit that has stumped me.

Cheers
Bec

"Gord Dibben" wrote:

Your code is not deleting columns, it is hiding Columns E through G

I guess I don't understand what you mean by "ignoring the top row".

When hiding or deleting columns you cannot ignore the top row or those columns.


Gord

On Fri, 18 Jul 2008 08:48:00 -0700, Bec wrote:

I am trying to hide the entire column. It works fine when I record the macro.
No problem and I don't have to delete the top row. But when I run the macro
it doesn't work. It deletes all my columns. After hours or fiddling I tried
deleting the top row and running the macro again and it worked. But I can't
delete the top row generally as it keeps getting regenerated anyway. So I
need a way to run the macro with ignoring the top row.

It's weird because it does work when I first record the macro so obviously
excel knows to ignore the top row then just not when it reruns the macro



"Gord Dibben" wrote:

You can't hide just part of a column.............all or nothing


Gord Dibben MS Excel MVP

On Fri, 18 Jul 2008 08:28:01 -0700, Bec wrote:

I am trying to delete some columns programmatically. I have been recording a
macro and then editing the code.

This is the code I am using:
Columns("E:G").Select
Range("E2").Activate
Selection.EntireColumn.Hidden = True

This works fine for the macro. When I go to rerun it, it fails. If I delete
the top merged heading row then it works. This heading gets automatically
created from another program so I can't delete it but I want my code to
ignore the top row when deleting the columns programmatically

I hope I am making myself clear. And I hope that someone can help me out.

Cheers
Bec




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
ignore #n/a GENO Excel Discussion (Misc queries) 2 November 25th 09 02:41 PM
ignore #N/A in a sum? Todd Excel Worksheet Functions 3 September 5th 06 10:05 PM
IF to ignore #N/A claytorm Excel Discussion (Misc queries) 6 November 21st 05 07:53 PM
please ignore Jordan Excel Worksheet Functions 0 June 17th 05 12:00 AM
Ignore #DIV/0! DLZ217 Excel Worksheet Functions 4 April 26th 05 03:20 AM


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