Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete columns
Hi,
Could someone give me a code that will delete every other colum between cells B:BA starting with cell B. There are 52 cells betweee B:BA including them. Don't know if that helps or not. Here is a cod I tried that basically took a long time before deleting all columns: Dim i As Long For i = 52 To 2 Step -1 Columns(i + 1).EntireColumn.Delete Next i Since this is a relatively short code, could someone break it down fo me also? I am really trying to learn this stuff, I have bought 3 book but I just never feel like reading them after work. Thanks, Scott -- Message posted from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete columns
Don,
none of those seemed to work for me. It's possible I'm not allowing i enough time. I have anywhere from 50-150 rows of actual data, and the all rows underneath (yes, all the way down to row 65536) contains "-". How long should the module take to run? Based on what I've told you which would be the fastest? Thanks, I appreciate any assistanc -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete columns
Is this a different question?
-- Don Guillett SalesAid Software "Scottmk " wrote in message ... Don, none of those seemed to work for me. It's possible I'm not allowing it enough time. I have anywhere from 50-150 rows of actual data, and then all rows underneath (yes, all the way down to row 65536) contains "-". How long should the module take to run? Based on what I've told you, which would be the fastest? Thanks, I appreciate any assistance --- Message posted from http://www.ExcelForum.com/ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete columns
OK, I got one of them to work:
Sub DeleteAltCols() Dim i As Integer For i = Columns.Count To 1 Step -1 If i Mod 2 = 0 Then Cells(1, i).EntireColumn.Delete Next End Sub But man, it took like 5 minutes to run. The part where I could tell i was actually deleting didn't seem to take long at all, but the par before that took a long time. Any suggestions -- Message posted from http://www.ExcelForum.com |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete columns
Don,
no, it wasn't a different question. Since you gave me so man different options on how to handle the situation, I was just giving yo more information on the sheet I was trying to use it for. ...so that yo could hopefully recommend the most appropriate code (fastest) to get th job done. Thank -- Message posted from http://www.ExcelForum.com |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete columns
You should always turn off screen updating and calculation during the macro.
Turn back on after. -- Don Guillett SalesAid Software "Scottmk " wrote in message ... OK, I got one of them to work: Sub DeleteAltCols() Dim i As Integer For i = Columns.Count To 1 Step -1 If i Mod 2 = 0 Then Cells(1, i).EntireColumn.Delete Next End Sub But man, it took like 5 minutes to run. The part where I could tell it was actually deleting didn't seem to take long at all, but the part before that took a long time. Any suggestions? --- Message posted from http://www.ExcelForum.com/ |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete columns
Don,
Actually, I think I have solved all of my problems...thanks to you. However, you have me puzzled with your last post. I'm not sure wha you mean by turn off screen updating and calculating during macro...ho do I do that? Thanks again for all of your help, Scot -- Message posted from http://www.ExcelForum.com |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete columns
application.screenupdating=false Application.Calculation = xlCalculateManual code application.screenupdating=true Application.Calculation = xlCalculateautomatic -- Don Guillett SalesAid Software "Scottmk " wrote in message ... Don, Actually, I think I have solved all of my problems...thanks to you. However, you have me puzzled with your last post. I'm not sure what you mean by turn off screen updating and calculating during macro...how do I do that? Thanks again for all of your help, Scott --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
delete columns if 0 | New Users to Excel | |||
Delete Columns | New Users to Excel | |||
merge text from 2 columns into 1 then delete the old 2 columns | Excel Worksheet Functions | |||
Can't delete columns | Excel Discussion (Misc queries) | |||
Delete columns | Excel Programming |