Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default how to remove every seventh column from excel

Hello,
does anyone know how to remove every seventh column from my excel. I know I
can do that manually, but there are too many columns, so, if there any easier
way to do this, instead of deleting one by one?

Thanks,
Smoki
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default how to remove every seventh column from excel

The best solution would be to use a macro to delete every 7th column. 7, 14,
21 etc; Since it is not sure you want to delete the column or remove the
contents I have written both..You can try out the below macros. If you are
new to macros..

--Set the Security level to low/medium in (Tools|Macro|Security).
--From workbook launch VBE using short-key Alt+F11.
--From menu 'Insert' a module and paste the below code.
--Get back to Workbook.
--Run macro from Tools|Macro|Run <selected macro()

Sub RemoveDatafrom7thColumn()
'Macro to remove contents
Dim lngCol As Long, lngLastCol As Long
lngLastCol = ActiveSheet.Cells.Find(What:="*", _
SearchDirection:=xlPrevious, SearchOrder:=xlByColumns).Column
For lngCol = 7 To lngLastCol Step 7
Columns(lngCol).ClearContents
Next
End Sub


Sub Delete7thColumn()
'Macro to delete the columns
Dim lngCol As Long, lngLastCol As Long
lngLastCol = ActiveSheet.Cells.Find(What:="*", _
SearchDirection:=xlPrevious, SearchOrder:=xlByColumns).Column
lngLastCol = (1 + Int(lngLastCol / 7)) * 7
For lngCol = lngLastCol To 1 Step -7
Columns(lngCol).Delete
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Smoki" wrote:

Hello,
does anyone know how to remove every seventh column from my excel. I know I
can do that manually, but there are too many columns, so, if there any easier
way to do this, instead of deleting one by one?

Thanks,
Smoki

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default how to remove every seventh column from excel

THANK YOU, you are great, and it works :)

Smoki

"Jacob Skaria" wrote:

The best solution would be to use a macro to delete every 7th column. 7, 14,
21 etc; Since it is not sure you want to delete the column or remove the
contents I have written both..You can try out the below macros. If you are
new to macros..

--Set the Security level to low/medium in (Tools|Macro|Security).
--From workbook launch VBE using short-key Alt+F11.
--From menu 'Insert' a module and paste the below code.
--Get back to Workbook.
--Run macro from Tools|Macro|Run <selected macro()

Sub RemoveDatafrom7thColumn()
'Macro to remove contents
Dim lngCol As Long, lngLastCol As Long
lngLastCol = ActiveSheet.Cells.Find(What:="*", _
SearchDirection:=xlPrevious, SearchOrder:=xlByColumns).Column
For lngCol = 7 To lngLastCol Step 7
Columns(lngCol).ClearContents
Next
End Sub


Sub Delete7thColumn()
'Macro to delete the columns
Dim lngCol As Long, lngLastCol As Long
lngLastCol = ActiveSheet.Cells.Find(What:="*", _
SearchDirection:=xlPrevious, SearchOrder:=xlByColumns).Column
lngLastCol = (1 + Int(lngLastCol / 7)) * 7
For lngCol = lngLastCol To 1 Step -7
Columns(lngCol).Delete
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Smoki" wrote:

Hello,
does anyone know how to remove every seventh column from my excel. I know I
can do that manually, but there are too many columns, so, if there any easier
way to do this, instead of deleting one by one?

Thanks,
Smoki

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
in excel, how do i remove quotes from column of 700 names Ayoaka Excel Discussion (Misc queries) 7 April 3rd 23 01:22 PM
remove duplicate rows from specific data in a column; excel 2007 DS Excel Worksheet Functions 1 August 6th 08 08:16 PM
Excel stack column: how to remove empty labels? [email protected] Charts and Charting in Excel 2 July 13th 06 06:04 PM
How do I delete every seventh row? Caroline Excel Worksheet Functions 3 October 6th 05 04:13 PM
Remove 1st 3 characters in each field of Excel column Chuck Excel Worksheet Functions 4 February 1st 05 09:43 PM


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