Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi All
I need to insert blank columns after each column of data on several worksheets. Can help? Thanks in advance. vcff |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Group the worksheets that should have this done to them.
Click on the first tab and ctrl-click on subsequent. Then run a macro: Option Explicit Sub testme() Dim wks As Worksheet Dim iCol As Long For Each wks In ActiveWindow.SelectedSheets With wks For iCol _ = .Cells.SpecialCells(xlCellTypeLastCell).Column To 1 Step -1 .Columns(iCol).Insert Next iCol End With Next wks End Sub If you're new to macros: Debra Dalgleish has some notes how to implement macros he http://www.contextures.com/xlvba01.html David McRitchie has an intro to macros: http://www.mvps.org/dmcritchie/excel/getstarted.htm Ron de Bruin's intro to macros: http://www.rondebruin.nl/code.htm (General, Regular and Standard modules all describe the same thing.) vcff wrote: Hi All I need to insert blank columns after each column of data on several worksheets. Can help? Thanks in advance. vcff -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
ps. remember to ungroup the sheets when you're done.
Rightclick on one of the selected sheets and choose Ungroup Sheets. vcff wrote: Hi All I need to insert blank columns after each column of data on several worksheets. Can help? Thanks in advance. vcff -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Dave,
Thanks for the reminder. vcff "Dave Peterson" wrote: ps. remember to ungroup the sheets when you're done. Rightclick on one of the selected sheets and choose Ungroup Sheets. vcff wrote: Hi All I need to insert blank columns after each column of data on several worksheets. Can help? Thanks in advance. vcff -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Try this simple macro:
Sub column_adder() Application.ScreenUpdating = False Dim r As Range For i = Columns.Count To 2 Step -1 Set r = Columns(i) r.Select If Application.WorksheetFunction.CountA(r) 0 Then Selection.Insert Shift:=xlToRight End If Next Application.ScreenUpdating = True End Sub -- Gary''s Student - gsnu200794 "vcff" wrote: Hi All I need to insert blank columns after each column of data on several worksheets. Can help? Thanks in advance. vcff |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Gary
Thanks, it works and save me lot of time to insert col by col. "Gary''s Student" wrote: Try this simple macro: Sub column_adder() Application.ScreenUpdating = False Dim r As Range For i = Columns.Count To 2 Step -1 Set r = Columns(i) r.Select If Application.WorksheetFunction.CountA(r) 0 Then Selection.Insert Shift:=xlToRight End If Next Application.ScreenUpdating = True End Sub -- Gary''s Student - gsnu200794 "vcff" wrote: Hi All I need to insert blank columns after each column of data on several worksheets. Can help? Thanks in advance. vcff |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You are very welcome !
-- Gary''s Student - gsnu200794 "vcff" wrote: Hi Gary Thanks, it works and save me lot of time to insert col by col. "Gary''s Student" wrote: Try this simple macro: Sub column_adder() Application.ScreenUpdating = False Dim r As Range For i = Columns.Count To 2 Step -1 Set r = Columns(i) r.Select If Application.WorksheetFunction.CountA(r) 0 Then Selection.Insert Shift:=xlToRight End If Next Application.ScreenUpdating = True End Sub -- Gary''s Student - gsnu200794 "vcff" wrote: Hi All I need to insert blank columns after each column of data on several worksheets. Can help? Thanks in advance. vcff |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
This macro would work.
Sub InsertCols() 'assume that a column has data if there is something in row 1 Range("IV1").End(xlToLeft).Select Let Y = ActiveCell.Column 'there are Y # of columns to insert For X = 1 To Y Columns(X + X).Select Selection.Insert Shift:=xlToRight Next End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
insert a blank column between each column in a data file | Excel Discussion (Misc queries) | |||
can't insert a column, can't shift columns off the sheet. | Excel Discussion (Misc queries) | |||
insert is deleting column data | Excel Discussion (Misc queries) | |||
unable to insert columns in excel, insert- columns (disabled) | Excel Discussion (Misc queries) | |||
insert a blank row after data changes in a column | Excel Discussion (Misc queries) |