Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro to delete columns

Hello,

I have a macro to import text file data into an Excel
spreadsheet. Sometimes, several columns imported have
blank data and can be random columns. I would like to
write a macro to do the followings:
1) From column A-M, If any column along row cell 9 is
blank, then delete the entire columns with blank data.

Thanks for any help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Macro to delete columns

Sub DeleteBlanks()
Range("A9:M9").SpecialCells(xlCellTypeBlanks).Enti reColumn.Delete
End Sub

--
HTH,
Laura Cook
Appleton, WI


"Luong" wrote in message
...
Hello,

I have a macro to import text file data into an Excel
spreadsheet. Sometimes, several columns imported have
blank data and can be random columns. I would like to
write a macro to do the followings:
1) From column A-M, If any column along row cell 9 is
blank, then delete the entire columns with blank data.

Thanks for any help.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro to delete columns

Laura,

Never mind my earlier reply, I got it. Thanks

-----Original Message-----
Hello Laura,

Thanks for the tip, but I have one problem.
The some unwanted columns might have some data in one of
the row (example row 10 or 45). Not all the unwanted
columns have blank data all the way down.
That's why I like to use row 9, which is a title row. So
if row 9 (on column A to M) is blank, then delete the
entire column.

I hope this will help in what I am trying to achieve.
Thanks again.

-----Original Message-----
Sub DeleteBlanks()
Range("A9:M9").SpecialCells

(xlCellTypeBlanks).EntireColumn.Delete
End Sub

--
HTH,
Laura Cook
Appleton, WI


"Luong" wrote in message
...
Hello,

I have a macro to import text file data into an Excel
spreadsheet. Sometimes, several columns imported have
blank data and can be random columns. I would like to
write a macro to do the followings:
1) From column A-M, If any column along row cell 9 is
blank, then delete the entire columns with blank data.

Thanks for any help.



.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Macro to delete columns

You're welcome, glad I could help.

--
Laura Cook
Appleton, WI


"Luong" wrote in message
...
Laura,

Never mind my earlier reply, I got it. Thanks

-----Original Message-----
Hello Laura,

Thanks for the tip, but I have one problem.
The some unwanted columns might have some data in one of
the row (example row 10 or 45). Not all the unwanted
columns have blank data all the way down.
That's why I like to use row 9, which is a title row. So
if row 9 (on column A to M) is blank, then delete the
entire column.

I hope this will help in what I am trying to achieve.
Thanks again.

-----Original Message-----
Sub DeleteBlanks()
Range("A9:M9").SpecialCells

(xlCellTypeBlanks).EntireColumn.Delete
End Sub

--
HTH,
Laura Cook
Appleton, WI


"Luong" wrote in message
...
Hello,

I have a macro to import text file data into an Excel
spreadsheet. Sometimes, several columns imported have
blank data and can be random columns. I would like to
write a macro to do the followings:
1) From column A-M, If any column along row cell 9 is
blank, then delete the entire columns with blank data.

Thanks for any help.


.

.



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
How can I update macro to delete zero amount columns? Nora_GG[_2_] Excel Discussion (Misc queries) 2 June 4th 10 12:35 AM
Auto Delete Columns in a Macro that are Blank dkeglor Excel Discussion (Misc queries) 1 October 31st 07 01:28 AM
merge text from 2 columns into 1 then delete the old 2 columns sleepindogg Excel Worksheet Functions 4 March 30th 06 07:25 PM
How can I delete a macro when the Delete button is not active? FCR Excel Worksheet Functions 0 March 9th 06 09:43 AM
How do i delete a macro in Excel 2003 when delete isn't highlight Abel Excel Discussion (Misc queries) 2 September 13th 05 04:09 AM


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