Hi everybody, i have a "beginer" question, i have an excel file with a lot of sheets, and every sheets contain at least one table but in different position, what i wanna do is delete all empty columns before the tables on each sheet, in order to have all the start on the same "B" column.
i tried to tinker a small macro but it doesnt work :
Thank you for your help.Sub DeleteColumns() Worksheets(2).Activate Worksheets(2).Range("B1:B100").Select If Sum(Selection).Value = 0 Then Column("B").EntireColumn.Delete Else End Sub![]()
Last edited by anasleco; 12-06-2011 at 07:32 AM. Reason: conform to rule 3 of the forum
Is there anything common contained within each table, and unique to the table on each sheet? e.g. a column label or table header/description. Knowing this would allow a macro to determine the position of the table and hence be able to delete all the columns to the left.
Please update us and no doubt someone will come up with a solution.
Regards
Richard Buttrey
If this was useful then please rate it appropriately.
Click the small star iconat the bottom left of my post.
in fact the common thing between all the sheets is that the columns ti the left of the table are empty.
I'm sorry for that, i've edited my post.
sub snb() for each sh in sheets sh.columns(1).resize(,sh.usedrange.columns(1).column-1).delete next end sub
thnaks everybody for the great help![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks